adds feed

This commit is contained in:
Christian Beutel
2025-07-11 16:02:18 +02:00
parent 25bf00a38b
commit 237d12bfec
33 changed files with 967 additions and 119 deletions

27
db/util/feed.go Normal file
View File

@@ -0,0 +1,27 @@
package util
import "github.com/pocketbase/pocketbase/core"
type FeedType string
const (
ListFeed FeedType = "list"
TrailFeed FeedType = "trail"
SummitLogFeed FeedType = "summit_log"
)
func InsertIntoFeed(app core.App, actorId string, authorId string, itemId string, feedType FeedType) (*core.Record, error) {
collection, err := app.FindCollectionByNameOrId("feed")
if err != nil {
return nil, err
}
record := core.NewRecord(collection)
record.Set("actor", actorId)
record.Set("author", authorId)
record.Set("item", itemId)
record.Set("type", string(feedType))
return record, app.Save(record)
}