Places, Agents, Serials, Entries

This commit is contained in:
Simon Martens
2025-02-08 15:24:13 +01:00
parent f4cbb037e0
commit cfce7a2dc7
32 changed files with 451342 additions and 154 deletions

View File

@@ -1,7 +1,7 @@
package migrations
import (
"github.com/Theodor-Springmann-Stiftung/musenalm/models"
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
@@ -14,7 +14,7 @@ func init() {
return app.Save(agents)
}, func(app core.App) error {
agents, err := app.FindCollectionByNameOrId(models.AGENTS_TABLE)
agents, err := app.FindCollectionByNameOrId(dbmodels.AGENTS_TABLE)
if err != nil {
return nil
}
@@ -24,21 +24,21 @@ func init() {
}
func agentsTable() *core.Collection {
collection := core.NewBaseCollection(models.AGENTS_TABLE)
collection := core.NewBaseCollection(dbmodels.AGENTS_TABLE)
setBasicPublicRules(collection)
return collection
}
func agentsFields() core.FieldsList {
fields := core.NewFieldsList(
&core.TextField{Name: models.AGENTS_NAME_FIELD, Required: true, Presentable: true},
&core.BoolField{Name: models.AGENTS_CORP_FIELD, Required: false},
&core.BoolField{Name: models.AGENTS_FICTIONAL_FIELD, Required: false},
&core.URLField{Name: models.URI_FIELD, Required: false},
&core.TextField{Name: models.AGENTS_BIOGRAPHICAL_DATA_FIELD, Required: false, Presentable: true},
&core.TextField{Name: models.AGENTS_PROFESSION_FIELD, Required: false},
&core.TextField{Name: models.AGENTS_PSEUDONYMS_FIELD, Required: false},
&core.TextField{Name: models.REFERENCES_FIELD, Required: false},
&core.TextField{Name: dbmodels.AGENTS_NAME_FIELD, Required: true, Presentable: true},
&core.BoolField{Name: dbmodels.AGENTS_CORP_FIELD, Required: false},
&core.BoolField{Name: dbmodels.AGENTS_FICTIONAL_FIELD, Required: false},
&core.URLField{Name: dbmodels.URI_FIELD, Required: false},
&core.TextField{Name: dbmodels.AGENTS_BIOGRAPHICAL_DATA_FIELD, Required: false, Presentable: true},
&core.TextField{Name: dbmodels.AGENTS_PROFESSION_FIELD, Required: false},
&core.TextField{Name: dbmodels.AGENTS_PSEUDONYMS_FIELD, Required: false},
&core.TextField{Name: dbmodels.REFERENCES_FIELD, Required: false},
)
setMusenalmIDField(&fields)
@@ -50,6 +50,6 @@ func agentsFields() core.FieldsList {
func agentsIndexes(collection *core.Collection) {
addMusenalmIDIndex(collection)
addIndex(collection, models.AGENTS_NAME_FIELD, false)
addIndex(collection, models.URI_FIELD, true)
addIndex(collection, dbmodels.AGENTS_NAME_FIELD, false)
addIndex(collection, dbmodels.URI_FIELD, false)
}