From 687fc0e1f683ae51d74d2294be2af987a8457ea9 Mon Sep 17 00:00:00 2001 From: Christian Beutel <> Date: Sat, 12 Jul 2025 16:58:45 +0200 Subject: [PATCH] limits feed to public items --- .../1752332025_updated_profile_feed.go | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 db/migrations/1752332025_updated_profile_feed.go diff --git a/db/migrations/1752332025_updated_profile_feed.go b/db/migrations/1752332025_updated_profile_feed.go new file mode 100644 index 00000000..f5b40630 --- /dev/null +++ b/db/migrations/1752332025_updated_profile_feed.go @@ -0,0 +1,40 @@ +package migrations + +import ( + "encoding/json" + + "github.com/pocketbase/pocketbase/core" + m "github.com/pocketbase/pocketbase/migrations" +) + +func init() { + m.Register(func(app core.App) error { + collection, err := app.FindCollectionByNameOrId("pbc_1973704172") + if err != nil { + return err + } + + // update collection data + if err := json.Unmarshal([]byte(`{ + "viewQuery": "SELECT\n (ROW_NUMBER() OVER ()) as id,\n actor,\n item,\n type,\n created\nFROM\n (\n SELECT\n author as actor,\n id as item,\n 'list' as type,\n created\n FROM\n lists\n WHERE lists.public = TRUE\n UNION\n SELECT\n author as actor,\n id as item,\n 'trail' as type,\n created\n FROM trails\n WHERE trails.public = TRUE\n )\nORDER BY created desc;" + }`), &collection); err != nil { + return err + } + + return app.Save(collection) + }, func(app core.App) error { + collection, err := app.FindCollectionByNameOrId("pbc_1973704172") + if err != nil { + return err + } + + // update collection data + if err := json.Unmarshal([]byte(`{ + "viewQuery": "SELECT\n (ROW_NUMBER() OVER ()) as id,\n actor,\n item,\n type,\n created\nFROM\n (\n SELECT\n author as actor,\n id as item,\n 'list' as type,\n created\n FROM\n lists\n UNION\n SELECT\n author as actor,\n id as item,\n 'trail' as type,\n created\n FROM trails\n )\nORDER BY created desc;" + }`), &collection); err != nil { + return err + } + + return app.Save(collection) + }) +}