adds translation and updated rules
This commit is contained in:
@@ -52,7 +52,7 @@ func init() {
|
||||
settings.Set("unit", unit)
|
||||
settings.Set("location", location)
|
||||
settings.Set("user", user.Id)
|
||||
settings.Set("mapFocus", "trails")
|
||||
settings.Set("mapFocus", "location")
|
||||
if err := dao.SaveRecord(settings); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
38
db/migrations/1713034732_updated_waypoints.go
Normal file
38
db/migrations/1713034732_updated_waypoints.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("goeo2ubp103rzp9")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("@request.auth.id != \"\" && (@collection.trails.waypoints.id ?= id && (@collection.trails.author ?= @request.auth.id || @collection.trails.public ?= true) || author = @request.auth.id)")
|
||||
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != \"\" && (@collection.trails.waypoints.id ?= id && (@collection.trails.author ?= @request.auth.id || @collection.trails.public ?= true) || author = @request.auth.id)")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("goeo2ubp103rzp9")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("@request.auth.id != \"\" && (@collection.trails.waypoints.id ?= id && (@collection.trails.author = @request.auth.id || @collection.trails.public = true) || author = @request.auth.id)")
|
||||
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != \"\" && (@collection.trails.waypoints.id ?= id && (@collection.trails.author = @request.auth.id || @collection.trails.public = true) || author = @request.auth.id)")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
50
db/migrations/1713035768_updated_comments.go
Normal file
50
db/migrations/1713035768_updated_comments.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("lf06qip3f4d11yk")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("((@request.auth.id != \"\" && trail.author = @request.auth.id) || trail.public = true) || author = @request.auth.id")
|
||||
|
||||
collection.ViewRule = types.Pointer("((@request.auth.id != \"\" && trail.author = @request.auth.id) || trail.public = true) || author = @request.auth.id")
|
||||
|
||||
collection.CreateRule = types.Pointer("@request.auth.id != \"\" && (trail.author = @request.auth.id || trail.public = true)")
|
||||
|
||||
collection.UpdateRule = types.Pointer("@request.auth.id = author")
|
||||
|
||||
collection.DeleteRule = types.Pointer("@request.auth.id = author")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("lf06qip3f4d11yk")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("")
|
||||
|
||||
collection.ViewRule = types.Pointer("")
|
||||
|
||||
collection.CreateRule = types.Pointer("")
|
||||
|
||||
collection.UpdateRule = types.Pointer("")
|
||||
|
||||
collection.DeleteRule = types.Pointer("")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user