mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
+exemplate, +fields
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dbmodels
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
@@ -186,6 +187,17 @@ func Contents_Entry(app core.App, id string) ([]*Content, error) {
|
||||
)
|
||||
}
|
||||
|
||||
func Items_Entry(app core.App, id string) ([]*Item, error) {
|
||||
var ret []*Item
|
||||
err := app.RecordQuery(ITEMS_TABLE).
|
||||
Where(dbx.NewExp(
|
||||
ENTRIES_TABLE+" = {:id} OR (json_valid("+ENTRIES_TABLE+") = 1 AND EXISTS (SELECT 1 FROM json_each("+ENTRIES_TABLE+") WHERE value = {:id}))",
|
||||
dbx.Params{"id": id},
|
||||
)).
|
||||
All(&ret)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func Contents_MusenalmID(app core.App, id string) (*Content, error) {
|
||||
ret, err := TableByField[Content](app, CONTENTS_TABLE, MUSENALMID_FIELD, id)
|
||||
return &ret, err
|
||||
|
||||
Reference in New Issue
Block a user