mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-28 16:55:32 +00:00
All table column names went into consts
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
places := placesTable()
|
||||
places.Fields = placesFields(places)
|
||||
places.Fields = placesFields()
|
||||
placesIndexes(places)
|
||||
|
||||
return app.Save(places)
|
||||
@@ -29,11 +29,11 @@ func placesTable() *core.Collection {
|
||||
return collection
|
||||
}
|
||||
|
||||
func placesFields(collection *core.Collection) core.FieldsList {
|
||||
func placesFields() core.FieldsList {
|
||||
fields := core.NewFieldsList(
|
||||
&core.TextField{Name: "name", Required: true, Presentable: true},
|
||||
&core.BoolField{Name: "fictional", Required: false},
|
||||
&core.URLField{Name: "registry_domains", Required: false, OnlyDomains: []string{"geonames.org"}},
|
||||
&core.TextField{Name: models.PLACES_NAME_FIELD, Required: true, Presentable: true},
|
||||
&core.BoolField{Name: models.AGENTS_FICTIONAL_FIELD, Required: false},
|
||||
&core.URLField{Name: models.URI_FIELD, Required: false, OnlyDomains: []string{"geonames.org"}},
|
||||
)
|
||||
|
||||
setMusenalmIDField(&fields)
|
||||
@@ -45,5 +45,6 @@ func placesFields(collection *core.Collection) core.FieldsList {
|
||||
|
||||
func placesIndexes(collection *core.Collection) {
|
||||
addMusenalmIDIndex(collection)
|
||||
addIndex(collection, "name", false)
|
||||
addIndex(collection, models.PLACES_NAME_FIELD, false)
|
||||
addIndex(collection, models.URI_FIELD, true)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
agents := agentsTable()
|
||||
agents.Fields = agentsFields(agents)
|
||||
agents.Fields = agentsFields()
|
||||
agentsIndexes(agents)
|
||||
|
||||
return app.Save(agents)
|
||||
@@ -29,16 +29,16 @@ func agentsTable() *core.Collection {
|
||||
return collection
|
||||
}
|
||||
|
||||
func agentsFields(collection *core.Collection) core.FieldsList {
|
||||
func agentsFields() core.FieldsList {
|
||||
fields := core.NewFieldsList(
|
||||
&core.TextField{Name: "name", Required: true, Presentable: true},
|
||||
&core.BoolField{Name: "corporate_body", Required: false},
|
||||
&core.BoolField{Name: "fictional", Required: false},
|
||||
&core.URLField{Name: "registry_domains", Required: false},
|
||||
&core.TextField{Name: "biographical_data", Required: false, Presentable: true},
|
||||
&core.TextField{Name: "profession", Required: false},
|
||||
&core.TextField{Name: "pseudonyms", Required: false},
|
||||
&core.TextField{Name: "references", Required: false},
|
||||
&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},
|
||||
)
|
||||
|
||||
setMusenalmIDField(&fields)
|
||||
@@ -50,5 +50,6 @@ func agentsFields(collection *core.Collection) core.FieldsList {
|
||||
|
||||
func agentsIndexes(collection *core.Collection) {
|
||||
addMusenalmIDIndex(collection)
|
||||
addIndex(collection, "name", false)
|
||||
addIndex(collection, models.AGENTS_NAME_FIELD, false)
|
||||
addIndex(collection, models.URI_FIELD, true)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
series := seriesTable()
|
||||
series.Fields = seriesFields(series)
|
||||
series.Fields = seriesFields()
|
||||
seriesIndexes(series)
|
||||
|
||||
return app.Save(series)
|
||||
@@ -29,11 +29,11 @@ func seriesTable() *core.Collection {
|
||||
return collection
|
||||
}
|
||||
|
||||
func seriesFields(collection *core.Collection) core.FieldsList {
|
||||
func seriesFields() core.FieldsList {
|
||||
fields := core.NewFieldsList(
|
||||
&core.TextField{Name: "name", Required: true, Presentable: true},
|
||||
&core.TextField{Name: "pseudonyms", Required: false},
|
||||
&core.TextField{Name: "references", Required: false},
|
||||
&core.TextField{Name: models.SERIES_NAME_FIELD, Required: true, Presentable: true},
|
||||
&core.TextField{Name: models.SERIES_PSEUDONYMS_FIELD, Required: false},
|
||||
&core.TextField{Name: models.REFERENCES_FIELD, Required: false},
|
||||
)
|
||||
|
||||
setMusenalmIDField(&fields)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
entries := entriesTable()
|
||||
fields := entriesFields(entries, app)
|
||||
fields := entriesFields(app)
|
||||
if fields == nil {
|
||||
return errors.New("Could not find places collection")
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func entriesTable() *core.Collection {
|
||||
return collection
|
||||
}
|
||||
|
||||
func entriesFields(collection *core.Collection, app core.App) *core.FieldsList {
|
||||
func entriesFields(app core.App) *core.FieldsList {
|
||||
places, err := app.FindCollectionByNameOrId(models.PLACES_TABLE)
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -44,43 +44,74 @@ func entriesFields(collection *core.Collection, app core.App) *core.FieldsList {
|
||||
|
||||
fields := core.NewFieldsList(
|
||||
// Title information
|
||||
&core.TextField{Name: "preferredtitle", Required: true, Presentable: true},
|
||||
&core.TextField{Name: "varianttitle", Required: false, Presentable: false},
|
||||
&core.BoolField{Name: "paralleltitle", Required: false},
|
||||
&core.TextField{Name: models.PREFERRED_TITLE_FIELD, Required: true, Presentable: true},
|
||||
&core.TextField{Name: models.VARIANT_TITLE_FIELD, Required: false, Presentable: false},
|
||||
&core.BoolField{Name: models.PARALLEL_TITLE_FIELD, Required: false},
|
||||
|
||||
// Transcribed information
|
||||
&core.TextField{Name: "title_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "subtitle_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "incipit_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.TITLE_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.SUBTITLE_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.INCIPIT_STMT_FIELD, Required: false, Presentable: false},
|
||||
|
||||
&core.TextField{Name: "responsibility_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "place_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "publication_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.RESPONSIBILITY_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.PLACE_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.PUBLICATION_STMT_FIELD, Required: false, Presentable: false},
|
||||
|
||||
// Other discerning Information
|
||||
&core.NumberField{Name: "year", Required: false},
|
||||
&core.TextField{Name: "edition", Required: false},
|
||||
&core.NumberField{Name: models.YEAR_FIELD, Required: false},
|
||||
&core.TextField{Name: models.EDITION_FIELD, Required: false},
|
||||
|
||||
// Media Information
|
||||
&core.SelectField{Name: "language", Required: false, Values: models.LANGUAGE_VALUES, MaxSelect: len(models.LANGUAGE_VALUES)},
|
||||
&core.SelectField{Name: "content_type", Required: false, Values: models.CONTENT_TYPE_VALUES, MaxSelect: len(models.CONTENT_TYPE_VALUES)},
|
||||
&core.SelectField{
|
||||
Name: models.LANGUAGE_FIELD,
|
||||
Required: false,
|
||||
Values: models.LANGUAGE_VALUES,
|
||||
MaxSelect: len(models.LANGUAGE_VALUES),
|
||||
},
|
||||
&core.SelectField{
|
||||
Name: models.CONTENT_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.CONTENT_TYPE_VALUES,
|
||||
MaxSelect: len(models.CONTENT_TYPE_VALUES),
|
||||
},
|
||||
|
||||
// Physical Description
|
||||
&core.TextField{Name: "extent", Required: false},
|
||||
&core.TextField{Name: "dimensions", Required: false},
|
||||
&core.SelectField{Name: "media_type", Required: false, Values: models.MEDIA_TYPE_VALUES, MaxSelect: len(models.MEDIA_TYPE_VALUES)},
|
||||
&core.SelectField{Name: "carrier_type", Required: false, Values: models.CARRIER_TYPE_VALUES, MaxSelect: len(models.CARRIER_TYPE_VALUES)},
|
||||
&core.TextField{Name: models.EXTENT_FIELD, Required: false},
|
||||
&core.TextField{Name: models.DIMENSIONS_FIELD, Required: false},
|
||||
&core.SelectField{
|
||||
Name: models.CARRIER_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.MEDIA_TYPE_VALUES,
|
||||
MaxSelect: len(models.MEDIA_TYPE_VALUES),
|
||||
},
|
||||
&core.SelectField{
|
||||
Name: models.CARRIER_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.CARRIER_TYPE_VALUES,
|
||||
MaxSelect: len(models.CARRIER_TYPE_VALUES),
|
||||
},
|
||||
|
||||
// Norm Data
|
||||
&core.TextField{Name: "references", Required: false},
|
||||
&core.RelationField{Name: "places", Required: false, CollectionId: places.Id, CascadeDelete: false, MaxSelect: 5000},
|
||||
&core.TextField{Name: models.REFERENCES_FIELD, Required: false},
|
||||
&core.RelationField{
|
||||
Name: models.PLACES_TABLE,
|
||||
Required: false,
|
||||
CollectionId: places.Id,
|
||||
CascadeDelete: false,
|
||||
MaxSelect: 5000,
|
||||
},
|
||||
|
||||
// Musenalm specific data
|
||||
&core.SelectField{Name: "musenalm_status", Required: false, Values: models.MUSENALM_STATUS_VALUES, MaxSelect: len(models.MUSENALM_STATUS_VALUES)},
|
||||
&core.JSONField{Name: "musenalm_deprecated", Required: false},
|
||||
&core.SelectField{
|
||||
Name: models.MUSENALM_BAENDE_STATUS_FIELD,
|
||||
Required: false,
|
||||
Values: models.MUSENALM_STATUS_VALUES,
|
||||
MaxSelect: len(models.MUSENALM_STATUS_VALUES),
|
||||
},
|
||||
&core.JSONField{Name: models.MUSENALM_DEPRECATED_FIELD, Required: false},
|
||||
|
||||
// Exemplare:
|
||||
&core.JSONField{Name: "items", Required: false},
|
||||
&core.JSONField{Name: models.ITEMS_TABLE, Required: false},
|
||||
)
|
||||
|
||||
setMusenalmIDField(&fields)
|
||||
@@ -92,15 +123,15 @@ func entriesFields(collection *core.Collection, app core.App) *core.FieldsList {
|
||||
|
||||
func entriesIndexes(collection *core.Collection) {
|
||||
addMusenalmIDIndex(collection)
|
||||
addIndex(collection, "preferredtitle", false)
|
||||
addIndex(collection, "varianttitle", false)
|
||||
addIndex(collection, "paralleltitle", false)
|
||||
addIndex(collection, "title_statement", false)
|
||||
addIndex(collection, "subtitle_statement", false)
|
||||
addIndex(collection, "incipit_statement", false)
|
||||
addIndex(collection, "responsibility_statement", false)
|
||||
addIndex(collection, "place_statement", false)
|
||||
addIndex(collection, "publication_statement", false)
|
||||
addIndex(collection, "year", false)
|
||||
addIndex(collection, "edition", false)
|
||||
addIndex(collection, models.PREFERRED_TITLE_FIELD, false)
|
||||
addIndex(collection, models.VARIANT_TITLE_FIELD, false)
|
||||
addIndex(collection, models.PARALLEL_TITLE_FIELD, false)
|
||||
addIndex(collection, models.TITLE_STMT_FIELD, false)
|
||||
addIndex(collection, models.SUBTITLE_STMT_FIELD, false)
|
||||
addIndex(collection, models.INCIPIT_STMT_FIELD, false)
|
||||
addIndex(collection, models.RESPONSIBILITY_STMT_FIELD, false)
|
||||
addIndex(collection, models.PLACE_STMT_FIELD, false)
|
||||
addIndex(collection, models.PUBLICATION_STMT_FIELD, false)
|
||||
addIndex(collection, models.YEAR_FIELD, false)
|
||||
addIndex(collection, models.EDITION_FIELD, false)
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ func init() {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.Fields.Add(&core.TextField{Name: "numbering", Required: false, Presentable: true})
|
||||
collection.Fields.Add(&core.TextField{Name: models.NUMBERING_FIELD, Required: false, Presentable: true})
|
||||
|
||||
return app.Save(collection)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId(relationTableName(models.ENTRIES_TABLE, models.SERIES_TABLE))
|
||||
collection, err := app.FindCollectionByNameOrId(models.RelationTableName(models.ENTRIES_TABLE, models.SERIES_TABLE))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -44,41 +44,85 @@ func partialsFields(app core.App) *core.FieldsList {
|
||||
|
||||
fields := core.NewFieldsList(
|
||||
// Title information
|
||||
&core.TextField{Name: "preferredtitle", Required: true, Presentable: true},
|
||||
&core.TextField{Name: "varianttitle", Required: false, Presentable: false},
|
||||
&core.BoolField{Name: "paralleltitle", Required: false},
|
||||
&core.TextField{Name: models.PREFERRED_TITLE_FIELD, Required: true, Presentable: true},
|
||||
&core.TextField{Name: models.VARIANT_TITLE_FIELD, Required: false, Presentable: false},
|
||||
&core.BoolField{Name: models.PARALLEL_TITLE_FIELD, Required: false},
|
||||
|
||||
// Transcribed information
|
||||
&core.TextField{Name: "title_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "subtitle_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "incipit_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.TITLE_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.SUBTITLE_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.INCIPIT_STMT_FIELD, Required: false, Presentable: false},
|
||||
|
||||
&core.TextField{Name: "responsibility_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "place_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: "publication_statement", Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.RESPONSIBILITY_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.PLACE_STMT_FIELD, Required: false, Presentable: false},
|
||||
&core.TextField{Name: models.PUBLICATION_STMT_FIELD, Required: false, Presentable: false},
|
||||
|
||||
// Other discerning Information
|
||||
&core.NumberField{Name: "year", Required: false},
|
||||
&core.TextField{Name: "edition", Required: false},
|
||||
&core.NumberField{Name: models.YEAR_FIELD, Required: false},
|
||||
&core.TextField{Name: models.EDITION_FIELD, Required: false},
|
||||
|
||||
// Media Information
|
||||
&core.SelectField{Name: "language", Required: false, Values: models.LANGUAGE_VALUES, MaxSelect: len(models.LANGUAGE_VALUES)},
|
||||
&core.SelectField{Name: "content_type", Required: false, Values: models.CONTENT_TYPE_VALUES, MaxSelect: len(models.CONTENT_TYPE_VALUES)},
|
||||
&core.SelectField{
|
||||
Name: models.LANGUAGE_FIELD,
|
||||
Required: false,
|
||||
Values: models.LANGUAGE_VALUES,
|
||||
MaxSelect: len(models.LANGUAGE_VALUES),
|
||||
},
|
||||
&core.SelectField{
|
||||
Name: models.CONTENT_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.CONTENT_TYPE_VALUES,
|
||||
MaxSelect: len(models.CONTENT_TYPE_VALUES),
|
||||
},
|
||||
|
||||
// Physical Description
|
||||
&core.TextField{Name: "extent", Required: false},
|
||||
&core.TextField{Name: "dimensions", Required: false},
|
||||
&core.SelectField{Name: "media_type", Required: false, Values: models.MEDIA_TYPE_VALUES, MaxSelect: len(models.MEDIA_TYPE_VALUES)},
|
||||
&core.SelectField{Name: "carrier_type", Required: false, Values: models.CARRIER_TYPE_VALUES, MaxSelect: len(models.CARRIER_TYPE_VALUES)},
|
||||
&core.TextField{Name: models.EXTENT_FIELD, Required: false},
|
||||
&core.TextField{Name: models.DIMENSIONS_FIELD, Required: false},
|
||||
&core.SelectField{
|
||||
Name: models.MEDIA_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.MEDIA_TYPE_VALUES,
|
||||
MaxSelect: len(models.MEDIA_TYPE_VALUES),
|
||||
},
|
||||
&core.SelectField{
|
||||
Name: models.CARRIER_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.CARRIER_TYPE_VALUES,
|
||||
MaxSelect: len(models.CARRIER_TYPE_VALUES),
|
||||
},
|
||||
|
||||
// Musenalm specific data
|
||||
&core.SelectField{Name: "musenalm_type", Required: false, Values: models.MUSENALM_TYPE_VALUES, MaxSelect: len(models.MUSENALM_TYPE_VALUES)},
|
||||
&core.SelectField{Name: "pagination", Required: false, Values: models.MUSENALM_PAGINATION_VALUES, MaxSelect: len(models.MUSENALM_PAGINATION_VALUES)},
|
||||
&core.FileField{Name: "scans", Required: false, MaxSize: 100 * 1024 * 1024, MaxSelect: 100, MimeTypes: models.MUSENALM_MIME_TYPES, Thumbs: []string{"0x300", "0x500", "0x1000", "300x0", "500x0", "1000x0"}}, // 100 MB a file
|
||||
&core.SelectField{
|
||||
Name: models.MUSENALM_INHALTE_TYPE_FIELD,
|
||||
Required: false,
|
||||
Values: models.MUSENALM_TYPE_VALUES,
|
||||
MaxSelect: len(models.MUSENALM_TYPE_VALUES),
|
||||
},
|
||||
&core.SelectField{
|
||||
Name: models.MUSENALM_PAGINATION_FIELD,
|
||||
Required: false,
|
||||
Values: models.MUSENALM_PAGINATION_VALUES,
|
||||
MaxSelect: len(models.MUSENALM_PAGINATION_VALUES),
|
||||
},
|
||||
&core.FileField{
|
||||
Name: models.SCAN_FIELD,
|
||||
Required: false,
|
||||
MaxSize: 100 * 1024 * 1024,
|
||||
MaxSelect: 1000,
|
||||
MimeTypes: models.MUSENALM_MIME_TYPES,
|
||||
Thumbs: []string{"0x300", "0x500", "0x1000", "300x0", "500x0", "1000x0"},
|
||||
}, // 100 MB a file
|
||||
|
||||
// Band:
|
||||
&core.NumberField{Name: "numbering", Required: false},
|
||||
&core.RelationField{Name: "entries", Required: true, CollectionId: entries.Id, CascadeDelete: false, MaxSelect: 1, MinSelect: 1},
|
||||
&core.NumberField{Name: models.NUMBERING_FIELD, Required: false},
|
||||
&core.RelationField{
|
||||
Name: models.ENTRIES_TABLE,
|
||||
Required: true,
|
||||
CollectionId: entries.Id,
|
||||
CascadeDelete: false,
|
||||
MaxSelect: 1,
|
||||
MinSelect: 1,
|
||||
},
|
||||
)
|
||||
|
||||
setMusenalmIDField(&fields)
|
||||
@@ -90,15 +134,15 @@ func partialsFields(app core.App) *core.FieldsList {
|
||||
|
||||
func partialsIndexes(collection *core.Collection) {
|
||||
addMusenalmIDIndex(collection)
|
||||
addIndex(collection, "preferredtitle", false)
|
||||
addIndex(collection, "varianttitle", false)
|
||||
addIndex(collection, "paralleltitle", false)
|
||||
addIndex(collection, "title_statement", false)
|
||||
addIndex(collection, "subtitle_statement", false)
|
||||
addIndex(collection, "incipit_statement", false)
|
||||
addIndex(collection, "responsibility_statement", false)
|
||||
addIndex(collection, "place_statement", false)
|
||||
addIndex(collection, "publication_statement", false)
|
||||
addIndex(collection, "year", false)
|
||||
addIndex(collection, "edition", false)
|
||||
addIndex(collection, models.PREFERRED_TITLE_FIELD, false)
|
||||
addIndex(collection, models.VARIANT_TITLE_FIELD, false)
|
||||
addIndex(collection, models.PARALLEL_TITLE_FIELD, false)
|
||||
addIndex(collection, models.TITLE_STMT_FIELD, false)
|
||||
addIndex(collection, models.SUBTITLE_STMT_FIELD, false)
|
||||
addIndex(collection, models.INCIPIT_STMT_FIELD, false)
|
||||
addIndex(collection, models.RESPONSIBILITY_STMT_FIELD, false)
|
||||
addIndex(collection, models.PLACE_STMT_FIELD, false)
|
||||
addIndex(collection, models.PUBLICATION_STMT_FIELD, false)
|
||||
addIndex(collection, models.YEAR_FIELD, false)
|
||||
addIndex(collection, models.EDITION_FIELD, false)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func init() {
|
||||
|
||||
return app.Save(collections)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId(relationTableName(models.PARTIALS_TABLE, models.AGENTS_TABLE))
|
||||
collection, err := app.FindCollectionByNameOrId(models.RelationTableName(models.PARTIALS_TABLE, models.AGENTS_TABLE))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func init() {
|
||||
|
||||
return app.Save(collections)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId(relationTableName(models.ENTRIES_TABLE, models.AGENTS_TABLE))
|
||||
collection, err := app.FindCollectionByNameOrId(models.RelationTableName(models.ENTRIES_TABLE, models.AGENTS_TABLE))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func setBasicPublicRules(collection *core.Collection) {
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != ''")
|
||||
collection.ViewRule = types.Pointer(models.PUBLIC_VIEW_RULE)
|
||||
}
|
||||
|
||||
func setMusenalmIDField(fieldlist *core.FieldsList) {
|
||||
@@ -43,15 +43,15 @@ func basicRelationCollection(app core.App, sourcetablename, targettablename stri
|
||||
return nil, err
|
||||
}
|
||||
|
||||
collection := core.NewBaseCollection(relationTableName(stable.Name, ttable.Name))
|
||||
collection := core.NewBaseCollection(models.RelationTableName(stable.Name, ttable.Name))
|
||||
setBasicPublicRules(collection)
|
||||
|
||||
fields := core.NewFieldsList(
|
||||
&core.RelationField{Name: stable.Name, Required: true, CollectionId: stable.Id, MinSelect: 1, MaxSelect: 1},
|
||||
&core.RelationField{Name: ttable.Name, Required: true, CollectionId: ttable.Id, MinSelect: 1, MaxSelect: 1},
|
||||
&core.SelectField{Name: "relation_type", Required: true, Values: relations, MaxSelect: 1},
|
||||
&core.BoolField{Name: "conjecture", Required: false},
|
||||
&core.BoolField{Name: "uncertain", Required: false},
|
||||
&core.SelectField{Name: models.RELATION_TYPE_FIELD, Required: true, Values: relations, MaxSelect: 1},
|
||||
&core.BoolField{Name: models.RELATION_CONJECTURE_FIELD, Required: false},
|
||||
&core.BoolField{Name: models.RELATION_UNCERTAIN_FIELD, Required: false},
|
||||
)
|
||||
|
||||
setNotesAndAnnotationsField(&fields)
|
||||
@@ -59,11 +59,7 @@ func basicRelationCollection(app core.App, sourcetablename, targettablename stri
|
||||
collection.Fields = fields
|
||||
addIndex(collection, stable.Name, false)
|
||||
addIndex(collection, ttable.Name, false)
|
||||
addIndex(collection, "relation_type", false)
|
||||
addIndex(collection, models.RELATION_TYPE_FIELD, false)
|
||||
|
||||
return collection, nil
|
||||
}
|
||||
|
||||
func relationTableName(collection1, collection2 string) string {
|
||||
return "R_" + collection1 + "_" + collection2
|
||||
}
|
||||
|
||||
@@ -396,15 +396,72 @@ var SERIES_RELATIONS = []string{
|
||||
}
|
||||
|
||||
const (
|
||||
PUBLIC_VIEW_RULE = "@request.auth.id != ''"
|
||||
|
||||
PLACES_TABLE = "places"
|
||||
AGENTS_TABLE = "agents"
|
||||
SERIES_TABLE = "series"
|
||||
ENTRIES_TABLE = "entries"
|
||||
PARTIALS_TABLE = "partials"
|
||||
ITEMS_TABLE = "items"
|
||||
|
||||
ANNOTATION_FIELD = "annotation"
|
||||
|
||||
MUSENALMID_FIELD = "musenalm_id"
|
||||
EDITSTATE_FIELD = "edit_state"
|
||||
COMMENT_FIELD = "edit_comment"
|
||||
|
||||
AGENTS_NAME_FIELD = "name"
|
||||
AGENTS_CORP_FIELD = "corporate_body"
|
||||
AGENTS_FICTIONAL_FIELD = "fictional"
|
||||
AGENTS_BIOGRAPHICAL_DATA_FIELD = "biographical_data"
|
||||
AGENTS_PROFESSION_FIELD = "profession"
|
||||
AGENTS_PSEUDONYMS_FIELD = "pseudonyms"
|
||||
|
||||
PLACES_NAME_FIELD = "name"
|
||||
PLACES_FICTIONAL_FIELD = "fictional"
|
||||
|
||||
SERIES_NAME_FIELD = "name"
|
||||
SERIES_PSEUDONYMS_FIELD = "pseudonyms"
|
||||
|
||||
RELATION_TYPE_FIELD = "type"
|
||||
RELATION_CONJECTURE_FIELD = "conjecture"
|
||||
RELATION_UNCERTAIN_FIELD = "uncertain"
|
||||
|
||||
PREFERRED_TITLE_FIELD = "preferred_title"
|
||||
VARIANT_TITLE_FIELD = "variant_title"
|
||||
PARALLEL_TITLE_FIELD = "parallel_title"
|
||||
|
||||
TITLE_STMT_FIELD = "title_statement"
|
||||
SUBTITLE_STMT_FIELD = "subtitle_statement"
|
||||
INCIPIT_STMT_FIELD = "incipit_statement"
|
||||
RESPONSIBILITY_STMT_FIELD = "responsibility_statement"
|
||||
PUBLICATION_STMT_FIELD = "publication_statement"
|
||||
PLACE_STMT_FIELD = "place_statement"
|
||||
|
||||
EDITION_FIELD = "edition"
|
||||
YEAR_FIELD = "year"
|
||||
|
||||
LANGUAGE_FIELD = "language"
|
||||
CONTENT_TYPE_FIELD = "content_type"
|
||||
|
||||
EXTENT_FIELD = "extent"
|
||||
DIMENSIONS_FIELD = "dimensions"
|
||||
MEDIA_TYPE_FIELD = "media_type"
|
||||
CARRIER_TYPE_FIELD = "carrier_type"
|
||||
|
||||
REFERENCES_FIELD = "references"
|
||||
URI_FIELD = "uri"
|
||||
|
||||
MUSENALM_BAENDE_STATUS_FIELD = "musenalm_status"
|
||||
MUSENALM_INHALTE_TYPE_FIELD = "musenalm_type"
|
||||
MUSENALM_DEPRECATED_FIELD = "musenalm_deprecated"
|
||||
MUSENALM_PAGINATION_FIELD = "musenalm_pagination"
|
||||
|
||||
NUMBERING_FIELD = "numbering"
|
||||
SCAN_FIELD = "scans"
|
||||
)
|
||||
|
||||
func RelationTableName(collection1, collection2 string) string {
|
||||
return "R_" + collection1 + "_" + collection2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user