mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Added DB models
This commit is contained in:
@@ -29,7 +29,7 @@ func init() {
|
|||||||
PRAGMA busy_timeout = 10000;
|
PRAGMA busy_timeout = 10000;
|
||||||
PRAGMA journal_mode = WAL;
|
PRAGMA journal_mode = WAL;
|
||||||
PRAGMA journal_size_limit = 200000000;
|
PRAGMA journal_size_limit = 200000000;
|
||||||
PRAGMA synchronous = NORMAL;
|
PRAGMA synchronous = FULL;
|
||||||
PRAGMA foreign_keys = ON;
|
PRAGMA foreign_keys = ON;
|
||||||
PRAGMA temp_store = MEMORY;
|
PRAGMA temp_store = MEMORY;
|
||||||
PRAGMA cache_size = -32768;
|
PRAGMA cache_size = -32768;
|
||||||
|
|||||||
111
dbmodels/agent.go
Normal file
111
dbmodels/agent.go
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*Agent)(nil)
|
||||||
|
|
||||||
|
type Agent struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAgent(record *core.Record) *Agent {
|
||||||
|
i := &Agent{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) TableName() string {
|
||||||
|
return AGENTS_TABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) Name() string {
|
||||||
|
return a.GetString(AGENTS_NAME_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetName(name string) {
|
||||||
|
a.Set(AGENTS_NAME_FIELD, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) Fictional() bool {
|
||||||
|
return a.GetBool(AGENTS_FICTIONAL_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetFictional(fictional bool) {
|
||||||
|
a.Set(AGENTS_FICTIONAL_FIELD, fictional)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) CorporateBody() bool {
|
||||||
|
return a.GetBool(AGENTS_CORP_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetCorporateBody(corporateBody bool) {
|
||||||
|
a.Set(AGENTS_CORP_FIELD, corporateBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) URI() string {
|
||||||
|
return a.GetString(URI_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetURI(uri string) {
|
||||||
|
a.Set(URI_FIELD, uri)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) BiographicalData() string {
|
||||||
|
return a.GetString(AGENTS_BIOGRAPHICAL_DATA_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetBiographicalData(biographicalData string) {
|
||||||
|
a.Set(AGENTS_BIOGRAPHICAL_DATA_FIELD, biographicalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) Profession() string {
|
||||||
|
return a.GetString(AGENTS_PROFESSION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetProfession(profession string) {
|
||||||
|
a.Set(AGENTS_PROFESSION_FIELD, profession)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) Pseudonyms() string {
|
||||||
|
return a.GetString(AGENTS_PSEUDONYMS_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetPseudonyms(pseudonyms string) {
|
||||||
|
a.Set(AGENTS_PSEUDONYMS_FIELD, pseudonyms)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) References() string {
|
||||||
|
return a.GetString(REFERENCES_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetReferences(references string) {
|
||||||
|
a.Set(REFERENCES_FIELD, references)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) Annotation() string {
|
||||||
|
return a.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetAnnotation(annotation string) {
|
||||||
|
a.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) MusenalmID() string {
|
||||||
|
return a.GetString(MUSENALMID_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetMusenalmID(id string) {
|
||||||
|
a.Set(MUSENALMID_FIELD, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) EditState() string {
|
||||||
|
return a.GetString(EDITSTATE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) SetEditState(editState string) {
|
||||||
|
a.Set(EDITSTATE_FIELD, editState)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Agent) Comment() string {
|
||||||
|
return a.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
package dbmodels
|
package dbmodels
|
||||||
|
|
||||||
type AnnotatioNotes struct {
|
|
||||||
Annotation string `json:",omitempty" db:"annotation"`
|
|
||||||
Notes string `json:",omitempty" db:"edit_comment"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FieldMetaData struct {
|
type FieldMetaData struct {
|
||||||
MetaData MetaData `json:",omitempty" db:"edit_fielddata"`
|
MetaData MetaData `json:",omitempty" db:"edit_fielddata"`
|
||||||
}
|
}
|
||||||
|
|||||||
203
dbmodels/content.go
Normal file
203
dbmodels/content.go
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*Content)(nil)
|
||||||
|
|
||||||
|
type Content struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewContent(record *core.Record) *Content {
|
||||||
|
i := &Content{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) TableName() string {
|
||||||
|
return CONTENTS_TABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) PreferredTitle() string {
|
||||||
|
return c.GetString(PREFERRED_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetPreferredTitle(preferredTitle string) {
|
||||||
|
c.Set(PREFERRED_TITLE_FIELD, preferredTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) VariantTitle() string {
|
||||||
|
return c.GetString(VARIANT_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetVariantTitle(variantTitle string) {
|
||||||
|
c.Set(VARIANT_TITLE_FIELD, variantTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) ParallelTitle() string {
|
||||||
|
return c.GetString(PARALLEL_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetParallelTitle(parallelTitle string) {
|
||||||
|
c.Set(PARALLEL_TITLE_FIELD, parallelTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) TitleStmt() string {
|
||||||
|
return c.GetString(TITLE_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetTitleStmt(titleStmt string) {
|
||||||
|
c.Set(TITLE_STMT_FIELD, titleStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SubtitleStmt() string {
|
||||||
|
return c.GetString(SUBTITLE_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetSubtitleStmt(subtitleStmt string) {
|
||||||
|
c.Set(SUBTITLE_STMT_FIELD, subtitleStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) IncipitStmt() string {
|
||||||
|
return c.GetString(INCIPIT_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetIncipitStmt(incipitStmt string) {
|
||||||
|
c.Set(INCIPIT_STMT_FIELD, incipitStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) ResponsibilityStmt() string {
|
||||||
|
return c.GetString(RESPONSIBILITY_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetResponsibilityStmt(responsibilityStmt string) {
|
||||||
|
c.Set(RESPONSIBILITY_STMT_FIELD, responsibilityStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) PublicationStmt() string {
|
||||||
|
return c.GetString(PUBLICATION_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetPublicationStmt(publicationStmt string) {
|
||||||
|
c.Set(PUBLICATION_STMT_FIELD, publicationStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) PlaceStmt() string {
|
||||||
|
return c.GetString(PLACE_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetPlaceStmt(placeStmt string) {
|
||||||
|
c.Set(PLACE_STMT_FIELD, placeStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Year() int {
|
||||||
|
return c.GetInt(YEAR_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetYear(year int) {
|
||||||
|
c.Set(YEAR_FIELD, year)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Language() []string {
|
||||||
|
return c.GetStringSlice(LANGUAGE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetLanguage(language []string) {
|
||||||
|
c.Set(LANGUAGE_FIELD, language)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) ContentType() []string {
|
||||||
|
return c.GetStringSlice(CONTENT_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetContentType(contentType []string) {
|
||||||
|
c.Set(CONTENT_TYPE_FIELD, contentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Extent() string {
|
||||||
|
return c.GetString(EXTENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetExtent(extent string) {
|
||||||
|
c.Set(EXTENT_FIELD, extent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Dimensions() string {
|
||||||
|
return c.GetString(DIMENSIONS_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetDimensions(dimensions string) {
|
||||||
|
c.Set(DIMENSIONS_FIELD, dimensions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) MusenalmType() []string {
|
||||||
|
return c.GetStringSlice(MUSENALM_INHALTE_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetMusenalmType(musenalmType []string) {
|
||||||
|
c.Set(MUSENALM_INHALTE_TYPE_FIELD, musenalmType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) MusenalmPagination() string {
|
||||||
|
return c.GetString(MUSENALM_PAGINATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetMusenalmPagination(musenalmPagination string) {
|
||||||
|
c.Set(MUSENALM_PAGINATION_FIELD, musenalmPagination)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Scans() []string {
|
||||||
|
return c.GetStringSlice(SCAN_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetScans(scans []string) {
|
||||||
|
c.Set(SCAN_FIELD, scans)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Numbering() float64 {
|
||||||
|
return c.GetFloat(NUMBERING_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetNumbering(numbering float64) {
|
||||||
|
c.Set(NUMBERING_FIELD, numbering)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Entry() string {
|
||||||
|
return c.GetString(ENTRIES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetEntry(entry string) {
|
||||||
|
c.Set(ENTRIES_TABLE, entry)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) MusenalmID() string {
|
||||||
|
return c.GetString(MUSENALMID_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetMusenalmID(musenalmID string) {
|
||||||
|
c.Set(MUSENALMID_FIELD, musenalmID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) EditState() string {
|
||||||
|
return c.GetString(EDITSTATE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetEditState(editState string) {
|
||||||
|
c.Set(EDITSTATE_FIELD, editState)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Annotation() string {
|
||||||
|
return c.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetAnnotation(annotation string) {
|
||||||
|
c.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) Comment() string {
|
||||||
|
return c.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Content) SetComment(comment string) {
|
||||||
|
c.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
@@ -434,10 +434,11 @@ const (
|
|||||||
AGENTS_PROFESSION_FIELD = "profession"
|
AGENTS_PROFESSION_FIELD = "profession"
|
||||||
AGENTS_PSEUDONYMS_FIELD = "pseudonyms"
|
AGENTS_PSEUDONYMS_FIELD = "pseudonyms"
|
||||||
|
|
||||||
PLACES_NAME_FIELD = "name"
|
PLACES_NAME_FIELD = "name"
|
||||||
PLACES_FICTIONAL_FIELD = "fictional"
|
PLACES_FICTIONAL_FIELD = "fictional"
|
||||||
|
PLACES_PSEUDONYMS_FIELD = "pseudonyms"
|
||||||
|
|
||||||
SERIES_NAME_FIELD = "name"
|
SERIES_TITLE_FIELD = "title"
|
||||||
SERIES_PSEUDONYMS_FIELD = "pseudonyms"
|
SERIES_PSEUDONYMS_FIELD = "pseudonyms"
|
||||||
SERIES_FREQUENCY_FIELD = "frequency"
|
SERIES_FREQUENCY_FIELD = "frequency"
|
||||||
|
|
||||||
|
|||||||
233
dbmodels/entry.go
Normal file
233
dbmodels/entry.go
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"github.com/pocketbase/pocketbase/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*Entry)(nil)
|
||||||
|
|
||||||
|
type Entry struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEntry(record *core.Record) *Entry {
|
||||||
|
i := &Entry{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) TableName() string {
|
||||||
|
return ENTRIES_TABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) PreferredTitle() string {
|
||||||
|
return e.GetString(PREFERRED_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetPreferredTitle(preferredTitle string) {
|
||||||
|
e.Set(PREFERRED_TITLE_FIELD, preferredTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) VariantTitle() string {
|
||||||
|
return e.GetString(VARIANT_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetVariantTitle(variantTitle string) {
|
||||||
|
e.Set(VARIANT_TITLE_FIELD, variantTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) ParallelTitle() string {
|
||||||
|
return e.GetString(PARALLEL_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetParallelTitle(parallelTitle string) {
|
||||||
|
e.Set(PARALLEL_TITLE_FIELD, parallelTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) TitleStmt() string {
|
||||||
|
return e.GetString(TITLE_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetTitleStmt(titleStmt string) {
|
||||||
|
e.Set(TITLE_STMT_FIELD, titleStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SubtitleStmt() string {
|
||||||
|
return e.GetString(SUBTITLE_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetSubtitleStmt(subtitleStmt string) {
|
||||||
|
e.Set(SUBTITLE_STMT_FIELD, subtitleStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) IncipitStmt() string {
|
||||||
|
return e.GetString(INCIPIT_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetIncipitStmt(incipitStmt string) {
|
||||||
|
e.Set(INCIPIT_STMT_FIELD, incipitStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) ResponsibilityStmt() string {
|
||||||
|
return e.GetString(RESPONSIBILITY_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetResponsibilityStmt(responsibilityStmt string) {
|
||||||
|
e.Set(RESPONSIBILITY_STMT_FIELD, responsibilityStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) PublicationStmt() string {
|
||||||
|
return e.GetString(PUBLICATION_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetPublicationStmt(publicationStmt string) {
|
||||||
|
e.Set(PUBLICATION_STMT_FIELD, publicationStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) PlaceStmt() string {
|
||||||
|
return e.GetString(PLACE_STMT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetPlaceStmt(placeStmt string) {
|
||||||
|
e.Set(PLACE_STMT_FIELD, placeStmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Year() int {
|
||||||
|
return e.GetInt(YEAR_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetYear(year int) {
|
||||||
|
e.Set(YEAR_FIELD, year)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Language() []string {
|
||||||
|
return e.GetStringSlice(LANGUAGE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetLanguage(language []string) {
|
||||||
|
e.Set(LANGUAGE_FIELD, language)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) ContentType() []string {
|
||||||
|
return e.GetStringSlice(CONTENT_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetContentType(contentType []string) {
|
||||||
|
e.Set(CONTENT_TYPE_FIELD, contentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Extent() string {
|
||||||
|
return e.GetString(EXTENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetExtent(extent string) {
|
||||||
|
e.Set(EXTENT_FIELD, extent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Dimensions() string {
|
||||||
|
return e.GetString(DIMENSIONS_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetDimensions(dimensions string) {
|
||||||
|
e.Set(DIMENSIONS_FIELD, dimensions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Edition() string {
|
||||||
|
return e.GetString(EDITION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetEdition(edition string) {
|
||||||
|
e.Set(EDITION_FIELD, edition)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) MediaType() []string {
|
||||||
|
return e.GetStringSlice(MEDIA_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetMediaType(mediaType []string) {
|
||||||
|
e.Set(MEDIA_TYPE_FIELD, mediaType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) CarrierType() []string {
|
||||||
|
return e.GetStringSlice(CARRIER_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetCarrierType(carrierType []string) {
|
||||||
|
e.Set(CARRIER_TYPE_FIELD, carrierType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) References() string {
|
||||||
|
return e.GetString(REFERENCES_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetReferences(references string) {
|
||||||
|
e.Set(REFERENCES_FIELD, references)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Places() []string {
|
||||||
|
return e.GetStringSlice(PLACES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetPlaces(places []string) {
|
||||||
|
e.Set(PLACES_TABLE, places)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Meta() map[string]MetaData {
|
||||||
|
md := make(map[string]MetaData)
|
||||||
|
err := e.UnmarshalJSONField(META_FIELD, &md)
|
||||||
|
if err != nil {
|
||||||
|
slog.Error("Error unmarshalling meta field", "error", err)
|
||||||
|
}
|
||||||
|
return md
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetMeta(meta map[string]MetaData) {
|
||||||
|
e.Set(META_FIELD, meta)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Deprecated() Deprecated {
|
||||||
|
d := Deprecated{}
|
||||||
|
err := e.UnmarshalJSONField(MUSENALM_DEPRECATED_FIELD, &d)
|
||||||
|
if err != nil {
|
||||||
|
slog.Error("Error unmarshalling deprecated field", "error", err)
|
||||||
|
}
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetDeprecated(deprecated Deprecated) {
|
||||||
|
e.Set(MUSENALM_DEPRECATED_FIELD, deprecated)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) MusenalmID() string {
|
||||||
|
return e.GetString(MUSENALMID_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetMusenalmID(musenalmID string) {
|
||||||
|
e.Set(MUSENALMID_FIELD, musenalmID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) EditState() string {
|
||||||
|
return e.GetString(EDITSTATE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetEditState(editState string) {
|
||||||
|
e.Set(EDITSTATE_FIELD, editState)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Annotation() string {
|
||||||
|
return e.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetAnnotation(annotation string) {
|
||||||
|
e.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) Comment() string {
|
||||||
|
return e.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Entry) SetComment(comment string) {
|
||||||
|
e.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
123
dbmodels/item.go
123
dbmodels/item.go
@@ -2,19 +2,122 @@ package dbmodels
|
|||||||
|
|
||||||
import "github.com/pocketbase/pocketbase/core"
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*Item)(nil)
|
||||||
|
|
||||||
type Item struct {
|
type Item struct {
|
||||||
core.BaseModel
|
core.BaseRecordProxy
|
||||||
Entry string `json:",omitempty" db:"entries"`
|
// Entry string `json:",omitempty" db:"entries"`
|
||||||
Identifier string `json:",omitempty" db:"identifier"`
|
// Identifier string `json:",omitempty" db:"identifier"`
|
||||||
Location string `json:",omitempty" db:"location"`
|
// Location string `json:",omitempty" db:"location"`
|
||||||
Owner string `json:",omitempty" db:"owner"`
|
// Owner string `json:",omitempty" db:"owner"`
|
||||||
Media string `json:",omitempty" db:"media"`
|
// Media string `json:",omitempty" db:"media"`
|
||||||
Condition string `json:",omitempty" db:"condition"`
|
// Condition string `json:",omitempty" db:"condition"`
|
||||||
Scans string `json:",omitempty" db:"scans"`
|
// Scans string `json:",omitempty" db:"scans"`
|
||||||
Uri string `json:",omitempty" db:"uri"`
|
// Uri string `json:",omitempty" db:"uri"`
|
||||||
AnnotatioNotes
|
}
|
||||||
|
|
||||||
|
func NewItem(record *core.Record) *Item {
|
||||||
|
i := &Item{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Item) TableName() string {
|
func (i *Item) TableName() string {
|
||||||
return ITEMS_TABLE
|
return ITEMS_TABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Item) Entry() string {
|
||||||
|
return a.GetString(ENTRIES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetEntry(entry string) {
|
||||||
|
a.Set(ENTRIES_TABLE, entry)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Identifier() string {
|
||||||
|
return a.GetString(ITEMS_IDENTIFIER_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetIdentifier(identifier string) {
|
||||||
|
a.Set(ITEMS_IDENTIFIER_FIELD, identifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Location() string {
|
||||||
|
return a.GetString(ITEMS_LOCATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetLocation(location string) {
|
||||||
|
a.Set(ITEMS_LOCATION_FIELD, location)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Owner() string {
|
||||||
|
return a.GetString(ITEMS_OWNER_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetOwner(owner string) {
|
||||||
|
a.Set(ITEMS_OWNER_FIELD, owner)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Media() []string {
|
||||||
|
return a.GetStringSlice(ITEMS_MEDIA_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetMedia(media []string) {
|
||||||
|
a.Set(ITEMS_MEDIA_FIELD, media)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Condition() string {
|
||||||
|
return a.GetString(ITEMS_CONDITION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetCondition(condition string) {
|
||||||
|
a.Set(ITEMS_CONDITION_FIELD, condition)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Scans() string {
|
||||||
|
return a.GetString(SCAN_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetScans(scans string) {
|
||||||
|
a.Set(SCAN_FIELD, scans)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Uri() string {
|
||||||
|
return a.GetString(URI_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetUri(uri string) {
|
||||||
|
a.Set(URI_FIELD, uri)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Notes() string {
|
||||||
|
return a.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetNotes(notes string) {
|
||||||
|
a.Set(COMMENT_FIELD, notes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Annotation() string {
|
||||||
|
return a.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetAnnotation(annotation string) {
|
||||||
|
a.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) EditState() string {
|
||||||
|
return a.GetString(EDITSTATE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetEditState(editState string) {
|
||||||
|
a.Set(EDITSTATE_FIELD, editState)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) Comments() string {
|
||||||
|
return a.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Item) SetComments(comments string) {
|
||||||
|
a.Set(COMMENT_FIELD, comments)
|
||||||
|
}
|
||||||
|
|||||||
75
dbmodels/place.go
Normal file
75
dbmodels/place.go
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*Place)(nil)
|
||||||
|
|
||||||
|
type Place struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPlace(record *core.Record) *Place {
|
||||||
|
i := &Place{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) TableName() string {
|
||||||
|
return PLACES_TABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) Name() string {
|
||||||
|
return p.GetString(PLACES_NAME_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetName(name string) {
|
||||||
|
p.Set(PLACES_NAME_FIELD, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) Fictional() bool {
|
||||||
|
return p.GetBool(PLACES_FICTIONAL_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetFictional(fictional bool) {
|
||||||
|
p.Set(PLACES_FICTIONAL_FIELD, fictional)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) URI() string {
|
||||||
|
return p.GetString(URI_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetURI(uri string) {
|
||||||
|
p.Set(URI_FIELD, uri)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) Annotation() string {
|
||||||
|
return p.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetAnnotation(annotation string) {
|
||||||
|
p.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) MusenalmID() string {
|
||||||
|
return p.GetString(MUSENALMID_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetMusenalmID(id string) {
|
||||||
|
p.Set(MUSENALMID_FIELD, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) EditState() string {
|
||||||
|
return p.GetString(EDITSTATE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetEditState(state string) {
|
||||||
|
p.Set(EDITSTATE_FIELD, state)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) Comment() string {
|
||||||
|
return p.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Place) SetComment(comment string) {
|
||||||
|
p.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
75
dbmodels/r_contents_agents.go
Normal file
75
dbmodels/r_contents_agents.go
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*RContentsAgents)(nil)
|
||||||
|
|
||||||
|
type RContentsAgents struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRContentsAgents(record *core.Record) *RContentsAgents {
|
||||||
|
i := &RContentsAgents{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) TableName() string {
|
||||||
|
return RelationTableName(CONTENTS_TABLE, AGENTS_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Content() string {
|
||||||
|
return r.GetString(CONTENTS_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetContent(content string) {
|
||||||
|
r.Set(CONTENTS_TABLE, content)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Agent() string {
|
||||||
|
return r.GetString(AGENTS_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetAgent(agent string) {
|
||||||
|
r.Set(AGENTS_TABLE, agent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Type() string {
|
||||||
|
return r.GetString(RELATION_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetType(relationType string) {
|
||||||
|
r.Set(RELATION_TYPE_FIELD, relationType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Annotation() string {
|
||||||
|
return r.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetAnnotation(annotation string) {
|
||||||
|
r.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Comment() string {
|
||||||
|
return r.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetComment(comment string) {
|
||||||
|
r.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Conjecture() bool {
|
||||||
|
return r.GetBool(RELATION_CONJECTURE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetConjecture(conjecture bool) {
|
||||||
|
r.Set(RELATION_CONJECTURE_FIELD, conjecture)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) Uncertain() bool {
|
||||||
|
return r.GetBool(RELATION_UNCERTAIN_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RContentsAgents) SetUncertain(uncertain bool) {
|
||||||
|
r.Set(RELATION_UNCERTAIN_FIELD, uncertain)
|
||||||
|
}
|
||||||
75
dbmodels/r_entries_agents.go
Normal file
75
dbmodels/r_entries_agents.go
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*REntriesAgents)(nil)
|
||||||
|
|
||||||
|
type REntriesAgents struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewREntriesAgents(record *core.Record) *REntriesAgents {
|
||||||
|
i := &REntriesAgents{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) TableName() string {
|
||||||
|
return RelationTableName(ENTRIES_TABLE, AGENTS_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Entry() string {
|
||||||
|
return r.GetString(ENTRIES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetEntry(entry string) {
|
||||||
|
r.Set(ENTRIES_TABLE, entry)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Agent() string {
|
||||||
|
return r.GetString(AGENTS_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetAgent(agent string) {
|
||||||
|
r.Set(AGENTS_TABLE, agent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Type() string {
|
||||||
|
return r.GetString(RELATION_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetType(relationType string) {
|
||||||
|
r.Set(RELATION_TYPE_FIELD, relationType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Annotation() string {
|
||||||
|
return r.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetAnnotation(annotation string) {
|
||||||
|
r.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Comment() string {
|
||||||
|
return r.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetComment(comment string) {
|
||||||
|
r.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Conjecture() bool {
|
||||||
|
return r.GetBool(RELATION_CONJECTURE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetConjecture(conjecture bool) {
|
||||||
|
r.Set(RELATION_CONJECTURE_FIELD, conjecture)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) Uncertain() bool {
|
||||||
|
return r.GetBool(RELATION_UNCERTAIN_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesAgents) SetUncertain(uncertain bool) {
|
||||||
|
r.Set(RELATION_UNCERTAIN_FIELD, uncertain)
|
||||||
|
}
|
||||||
83
dbmodels/r_entries_series.go
Normal file
83
dbmodels/r_entries_series.go
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*REntriesSeries)(nil)
|
||||||
|
|
||||||
|
type REntriesSeries struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewREntriesSeries(record *core.Record) *REntriesSeries {
|
||||||
|
i := &REntriesSeries{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) TableName() string {
|
||||||
|
return RelationTableName(ENTRIES_TABLE, SERIES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Entry() string {
|
||||||
|
return r.GetString(ENTRIES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetEntry(entry string) {
|
||||||
|
r.Set(ENTRIES_TABLE, entry)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Series() string {
|
||||||
|
return r.GetString(SERIES_TABLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetSeries(series string) {
|
||||||
|
r.Set(SERIES_TABLE, series)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Numbering() string {
|
||||||
|
return r.GetString(NUMBERING_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetNumbering(numbering string) {
|
||||||
|
r.Set(NUMBERING_FIELD, numbering)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Type() string {
|
||||||
|
return r.GetString(RELATION_TYPE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetType(relationType string) {
|
||||||
|
r.Set(RELATION_TYPE_FIELD, relationType)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Annotation() string {
|
||||||
|
return r.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetAnnotation(annotation string) {
|
||||||
|
r.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Comment() string {
|
||||||
|
return r.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetComment(comment string) {
|
||||||
|
r.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Conjecture() bool {
|
||||||
|
return r.GetBool(RELATION_CONJECTURE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetConjecture(conjecture bool) {
|
||||||
|
r.Set(RELATION_CONJECTURE_FIELD, conjecture)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) Uncertain() bool {
|
||||||
|
return r.GetBool(RELATION_UNCERTAIN_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *REntriesSeries) SetUncertain(uncertain bool) {
|
||||||
|
r.Set(RELATION_UNCERTAIN_FIELD, uncertain)
|
||||||
|
}
|
||||||
83
dbmodels/series.go
Normal file
83
dbmodels/series.go
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package dbmodels
|
||||||
|
|
||||||
|
import "github.com/pocketbase/pocketbase/core"
|
||||||
|
|
||||||
|
var _ core.RecordProxy = (*Series)(nil)
|
||||||
|
|
||||||
|
type Series struct {
|
||||||
|
core.BaseRecordProxy
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSeries(record *core.Record) *Series {
|
||||||
|
i := &Series{}
|
||||||
|
i.SetProxyRecord(record)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) TableName() string {
|
||||||
|
return SERIES_TABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) Title() string {
|
||||||
|
return s.GetString(SERIES_TITLE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetTitle(title string) {
|
||||||
|
s.Set(SERIES_TITLE_FIELD, title)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) Pseudonyms() string {
|
||||||
|
return s.GetString(SERIES_PSEUDONYMS_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetPseudonyms(pseudonyms string) {
|
||||||
|
s.Set(SERIES_PSEUDONYMS_FIELD, pseudonyms)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) References() string {
|
||||||
|
return s.GetString(REFERENCES_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetReferences(references string) {
|
||||||
|
s.Set(REFERENCES_FIELD, references)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) Annotation() string {
|
||||||
|
return s.GetString(ANNOTATION_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetAnnotation(annotation string) {
|
||||||
|
s.Set(ANNOTATION_FIELD, annotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) MusenalmID() string {
|
||||||
|
return s.GetString(MUSENALMID_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetMusenalmID(id string) {
|
||||||
|
s.Set(MUSENALMID_FIELD, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) EditState() string {
|
||||||
|
return s.GetString(EDITSTATE_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetEditState(editState string) {
|
||||||
|
s.Set(EDITSTATE_FIELD, editState)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) Comment() string {
|
||||||
|
return s.GetString(COMMENT_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetComment(comment string) {
|
||||||
|
s.Set(COMMENT_FIELD, comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) Frequency() string {
|
||||||
|
return s.GetString(SERIES_FREQUENCY_FIELD)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Series) SetFrequency(frequency string) {
|
||||||
|
s.Set(SERIES_FREQUENCY_FIELD, frequency)
|
||||||
|
}
|
||||||
@@ -32,6 +32,7 @@ func placesTable() *core.Collection {
|
|||||||
func placesFields() core.FieldsList {
|
func placesFields() core.FieldsList {
|
||||||
fields := core.NewFieldsList(
|
fields := core.NewFieldsList(
|
||||||
&core.TextField{Name: dbmodels.PLACES_NAME_FIELD, Required: true, Presentable: true},
|
&core.TextField{Name: dbmodels.PLACES_NAME_FIELD, Required: true, Presentable: true},
|
||||||
|
&core.TextField{Name: dbmodels.PLACES_PSEUDONYMS_FIELD, Required: false, Presentable: true},
|
||||||
&core.BoolField{Name: dbmodels.AGENTS_FICTIONAL_FIELD, Required: false},
|
&core.BoolField{Name: dbmodels.AGENTS_FICTIONAL_FIELD, Required: false},
|
||||||
&core.URLField{Name: dbmodels.URI_FIELD, Required: false, OnlyDomains: []string{"geonames.org"}},
|
&core.URLField{Name: dbmodels.URI_FIELD, Required: false, OnlyDomains: []string{"geonames.org"}},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func seriesTable() *core.Collection {
|
|||||||
|
|
||||||
func seriesFields() core.FieldsList {
|
func seriesFields() core.FieldsList {
|
||||||
fields := core.NewFieldsList(
|
fields := core.NewFieldsList(
|
||||||
&core.TextField{Name: dbmodels.SERIES_NAME_FIELD, Required: true, Presentable: true},
|
&core.TextField{Name: dbmodels.SERIES_TITLE_FIELD, Required: true, Presentable: true},
|
||||||
&core.TextField{Name: dbmodels.SERIES_PSEUDONYMS_FIELD, Required: false},
|
&core.TextField{Name: dbmodels.SERIES_PSEUDONYMS_FIELD, Required: false},
|
||||||
&core.TextField{Name: dbmodels.REFERENCES_FIELD, Required: false},
|
&core.TextField{Name: dbmodels.REFERENCES_FIELD, Required: false},
|
||||||
&core.TextField{Name: dbmodels.SERIES_FREQUENCY_FIELD, Required: false},
|
&core.TextField{Name: dbmodels.SERIES_FREQUENCY_FIELD, Required: false},
|
||||||
@@ -46,5 +46,5 @@ func seriesFields() core.FieldsList {
|
|||||||
|
|
||||||
func seriesIndexes(collection *core.Collection) {
|
func seriesIndexes(collection *core.Collection) {
|
||||||
addMusenalmIDIndex(collection)
|
addMusenalmIDIndex(collection)
|
||||||
addIndex(collection, "name", false)
|
addIndex(collection, dbmodels.SERIES_TITLE_FIELD, false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,9 +101,6 @@ func entriesFields(app core.App) *core.FieldsList {
|
|||||||
MaxSelect: 5000,
|
MaxSelect: 5000,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Exemplare:
|
|
||||||
&core.JSONField{Name: dbmodels.ITEMS_TABLE, Required: false},
|
|
||||||
|
|
||||||
// EDIT DATA:
|
// EDIT DATA:
|
||||||
&core.JSONField{Name: dbmodels.META_FIELD, Required: false},
|
&core.JSONField{Name: dbmodels.META_FIELD, Required: false},
|
||||||
&core.JSONField{Name: dbmodels.MUSENALM_DEPRECATED_FIELD, Required: false},
|
&core.JSONField{Name: dbmodels.MUSENALM_DEPRECATED_FIELD, Required: false},
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ func itemsFields(app core.App) core.FieldsList {
|
|||||||
)
|
)
|
||||||
|
|
||||||
setNotesAndAnnotationsField(&fields)
|
setNotesAndAnnotationsField(&fields)
|
||||||
|
setEditorStateField(&fields)
|
||||||
|
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package migrations
|
package migrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
|
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
|
||||||
"github.com/Theodor-Springmann-Stiftung/musenalm/migrations/seed"
|
"github.com/Theodor-Springmann-Stiftung/musenalm/migrations/seed"
|
||||||
"github.com/Theodor-Springmann-Stiftung/musenalm/xmlmodels"
|
"github.com/Theodor-Springmann-Stiftung/musenalm/xmlmodels"
|
||||||
@@ -19,86 +17,91 @@ func init() {
|
|||||||
|
|
||||||
adb.Reihen = xmlmodels.SanitizeReihen(adb.Reihen, adb.Relationen_Bände_Reihen)
|
adb.Reihen = xmlmodels.SanitizeReihen(adb.Reihen, adb.Relationen_Bände_Reihen)
|
||||||
|
|
||||||
wg := sync.WaitGroup{}
|
if records, err := seed.RecordsFromAkteure(app, adb.Akteure); err == nil {
|
||||||
wg.Add(3)
|
for _, record := range records {
|
||||||
go func() {
|
if err = app.Save(record); err != nil {
|
||||||
if records, err := seed.RecordsFromAkteure(app, adb.Akteure); err == nil {
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
wg.Done()
|
} else {
|
||||||
}()
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
if records, err := seed.RecordsFromOrte(app, adb.Orte); err == nil {
|
||||||
if records, err := seed.RecordsFromOrte(app, adb.Orte); err == nil {
|
for _, record := range records {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
if err = app.Save(record); err != nil {
|
||||||
panic(err)
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
wg.Done()
|
} else {
|
||||||
}()
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
if records, err := seed.RecordsFromReihentitel(app, adb.Reihen); err == nil {
|
||||||
if records, err := seed.RecordsFromReihentitel(app, adb.Reihen); err == nil {
|
for _, record := range records {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
if err = app.Save(record); err != nil {
|
||||||
panic(err)
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
wg.Done()
|
} else {
|
||||||
}()
|
panic(err)
|
||||||
|
}
|
||||||
wg.Wait()
|
|
||||||
|
|
||||||
if records, err := seed.RecordsFromBände(app, *adb); err == nil {
|
if records, err := seed.RecordsFromBände(app, *adb); err == nil {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
for _, record := range records {
|
||||||
panic(err)
|
if err = app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if records, err := seed.ItemsFromBändeAndBIBLIO(app, adb.Bände, adb.BIBLIO); err == nil {
|
if records, err := seed.ItemsFromBändeAndBIBLIO(app, adb.Bände, adb.BIBLIO); err == nil {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
for _, record := range records {
|
||||||
panic(err)
|
if err = app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if records, err := seed.RecordsFromInhalte(app, adb.Inhalte); err == nil {
|
if records, err := seed.RecordsFromInhalte(app, adb.Inhalte); err == nil {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
for _, record := range records {
|
||||||
panic(err)
|
if err = app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if records, err := seed.RecordsFromRelationBändeReihen(app, adb.Relationen_Bände_Reihen); err == nil {
|
if records, err := seed.RecordsFromRelationBändeReihen(app, adb.Relationen_Bände_Reihen); err == nil {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
for _, record := range records {
|
||||||
panic(err)
|
if err := app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if records, err := seed.RecordsFromRelationBändeAkteure(app, adb.Relationen_Bände_Akteure); err == nil {
|
if records, err := seed.RecordsFromRelationBändeAkteure(app, adb.Relationen_Bände_Akteure); err == nil {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
for _, record := range records {
|
||||||
panic(err)
|
if err := app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if records, err := seed.RecordsFromRelationInhalteAkteure(app, adb.Relationen_Inhalte_Akteure); err == nil {
|
if records, err := seed.RecordsFromRelationInhalteAkteure(app, adb.Relationen_Inhalte_Akteure); err == nil {
|
||||||
if err = seed.BatchSave(app, records); err != nil {
|
for _, record := range records {
|
||||||
panic(err)
|
if err := app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
@@ -8,31 +8,31 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromAkteure(app core.App, akteure xmlmodels.Akteure) ([]*core.Record, error) {
|
func RecordsFromAkteure(app core.App, akteure xmlmodels.Akteure) ([]*dbmodels.Agent, error) {
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.AGENTS_TABLE)
|
collection, err := app.FindCollectionByNameOrId(dbmodels.AGENTS_TABLE)
|
||||||
records := make([]*core.Record, 0, len(akteure.Akteure))
|
records := make([]*dbmodels.Agent, 0, len(akteure.Akteure))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return records, err
|
return records, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < len(akteure.Akteure); i++ {
|
for i := 0; i < len(akteure.Akteure); i++ {
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewAgent(core.NewRecord(collection))
|
||||||
akteur := akteure.Akteure[i]
|
akteur := akteure.Akteure[i]
|
||||||
record.Set(dbmodels.AGENTS_CORP_FIELD, akteur.Körperschaft)
|
record.SetCorporateBody(akteur.Körperschaft)
|
||||||
record.Set(dbmodels.AGENTS_NAME_FIELD, NormalizeString(akteur.Name))
|
record.SetName(NormalizeString(akteur.Name))
|
||||||
record.Set(dbmodels.REFERENCES_FIELD, NormalizeString(akteur.Nachweis))
|
record.SetReferences(NormalizeString(akteur.Nachweis))
|
||||||
record.Set(dbmodels.AGENTS_BIOGRAPHICAL_DATA_FIELD, NormalizeString(akteur.Lebensdaten))
|
record.SetBiographicalData(NormalizeString(akteur.Lebensdaten))
|
||||||
record.Set(dbmodels.AGENTS_PROFESSION_FIELD, NormalizeString(akteur.Beruf))
|
record.SetProfession(NormalizeString(akteur.Beruf))
|
||||||
record.Set(dbmodels.AGENTS_PSEUDONYMS_FIELD, NormalizeString(akteur.Pseudonyme))
|
record.SetPseudonyms(NormalizeString(akteur.Pseudonyme))
|
||||||
record.Set(dbmodels.ANNOTATION_FIELD, NormalizeString(akteur.Anmerkungen))
|
record.SetAnnotation(NormalizeString(akteur.Anmerkungen))
|
||||||
record.Set(dbmodels.MUSENALMID_FIELD, akteur.ID)
|
record.SetMusenalmID(akteur.ID)
|
||||||
|
|
||||||
n := akteur.Name
|
n := akteur.Name
|
||||||
if n == "" {
|
if n == "" {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[1])
|
||||||
} else {
|
} else {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
}
|
}
|
||||||
|
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package seed
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
|
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
|
||||||
@@ -9,43 +10,50 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromInhalte(app core.App, inhalte xmlmodels.Inhalte) ([]*core.Record, error) {
|
const NO_TITLE = "[No Title]"
|
||||||
|
|
||||||
|
func RecordsFromInhalte(app core.App, inhalte xmlmodels.Inhalte) ([]*dbmodels.Content, error) {
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.CONTENTS_TABLE)
|
collection, err := app.FindCollectionByNameOrId(dbmodels.CONTENTS_TABLE)
|
||||||
records := make([]*core.Record, 0, len(inhalte.Inhalte))
|
records := make([]*dbmodels.Content, 0, len(inhalte.Inhalte))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return records, err
|
return records, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < len(inhalte.Inhalte); i++ {
|
for i := 0; i < len(inhalte.Inhalte); i++ {
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewContent(core.NewRecord(collection))
|
||||||
inhalt := inhalte.Inhalte[i]
|
inhalt := inhalte.Inhalte[i]
|
||||||
band, err := app.FindFirstRecordByData(dbmodels.ENTRIES_TABLE, dbmodels.MUSENALMID_FIELD, inhalt.Band)
|
band, err := app.FindFirstRecordByData(dbmodels.ENTRIES_TABLE, dbmodels.MUSENALMID_FIELD, inhalt.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding band record for inhalt", "error", err, "inhalt", inhalt)
|
app.Logger().Error("Error finding band record for inhalt", "error", err, "inhalt", inhalt)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
record.Set(dbmodels.ENTRIES_TABLE, band.Id)
|
record.SetEntry(band.Id)
|
||||||
record.Set(dbmodels.ANNOTATION_FIELD, NormalizeString(inhalt.Anmerkungen))
|
record.SetAnnotation(NormalizeString(inhalt.Anmerkungen))
|
||||||
record.Set(dbmodels.MUSENALMID_FIELD, inhalt.ID)
|
record.SetMusenalmID(inhalt.ID)
|
||||||
record.Set(dbmodels.RESPONSIBILITY_STMT_FIELD, NormalizeString(inhalt.Urheberangabe))
|
record.SetResponsibilityStmt(NormalizeString(inhalt.Urheberangabe))
|
||||||
record.Set(dbmodels.MUSENALM_INHALTE_TYPE_FIELD, inhalt.Typ.Value)
|
record.SetMusenalmType(inhalt.Typ.Value)
|
||||||
record.Set(dbmodels.EXTENT_FIELD, NormalizeString(inhalt.Seite))
|
record.SetExtent(NormalizeString(inhalt.Seite))
|
||||||
record.Set(dbmodels.TITLE_STMT_FIELD, NormalizeString(inhalt.Titelangabe))
|
record.SetTitleStmt(NormalizeString(inhalt.Titelangabe))
|
||||||
record.Set(dbmodels.INCIPIT_STMT_FIELD, NormalizeString(inhalt.Incipit))
|
record.SetIncipitStmt(NormalizeString(inhalt.Incipit))
|
||||||
|
|
||||||
counting, ok := dbmodels.MUSENALM_PAGINATION_VALUES[inhalt.Paginierung]
|
counting, ok := dbmodels.MUSENALM_PAGINATION_VALUES[inhalt.Paginierung]
|
||||||
if ok {
|
if ok {
|
||||||
record.Set(dbmodels.MUSENALM_PAGINATION_FIELD, counting)
|
record.SetMusenalmPagination(counting)
|
||||||
}
|
}
|
||||||
record.Set(dbmodels.NUMBERING_FIELD, NormalizeString(inhalt.Objektnummer))
|
|
||||||
|
no, err := strconv.ParseFloat(NormalizeString(inhalt.Objektnummer), 64)
|
||||||
|
if err != nil {
|
||||||
|
app.Logger().Error("Error parsing object number", "error", err, "object number", inhalt.Objektnummer)
|
||||||
|
}
|
||||||
|
record.SetNumbering(no)
|
||||||
|
|
||||||
handlePreferredTitle(inhalt, record)
|
handlePreferredTitle(inhalt, record)
|
||||||
n := record.GetString(dbmodels.PREFERRED_TITLE_FIELD)
|
n := record.PreferredTitle()
|
||||||
if n == "" || n == "No Title" {
|
if n == "" || n == NO_TITLE {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[1])
|
||||||
} else {
|
} else {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
}
|
}
|
||||||
|
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
@@ -53,14 +61,14 @@ func RecordsFromInhalte(app core.App, inhalte xmlmodels.Inhalte) ([]*core.Record
|
|||||||
return records, nil
|
return records, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlePreferredTitle(inhalt xmlmodels.Inhalt, record *core.Record) {
|
func handlePreferredTitle(inhalt xmlmodels.Inhalt, record *dbmodels.Content) {
|
||||||
if inhalt.Titelangabe != "" {
|
if inhalt.Titelangabe != "" {
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, NormalizeString(inhalt.Titelangabe))
|
record.SetPreferredTitle(NormalizeString(inhalt.Titelangabe))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if inhalt.Incipit != "" {
|
if inhalt.Incipit != "" {
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, NormalizeString(inhalt.Incipit)+"…")
|
record.SetPreferredTitle(NormalizeString(inhalt.Incipit) + "…")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,12 +84,12 @@ func handlePreferredTitle(inhalt xmlmodels.Inhalt, record *core.Record) {
|
|||||||
urhh = NormalizeString(urhh)
|
urhh = NormalizeString(urhh)
|
||||||
str += " (" + urhh + ")"
|
str += " (" + urhh + ")"
|
||||||
}
|
}
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, "["+str+"]")
|
record.SetPreferredTitle("[" + str + "]")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, "[Kein Titel]")
|
record.SetPreferredTitle(NO_TITLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
func commatizeArray(array []string) string {
|
func commatizeArray(array []string) string {
|
||||||
|
|||||||
@@ -15,58 +15,61 @@ import (
|
|||||||
func RecordsFromBände(
|
func RecordsFromBände(
|
||||||
app core.App,
|
app core.App,
|
||||||
adb xmlmodels.AccessDB,
|
adb xmlmodels.AccessDB,
|
||||||
) ([]*core.Record, error) {
|
) ([]*dbmodels.Entry, error) {
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.ENTRIES_TABLE)
|
collection, err := app.FindCollectionByNameOrId(dbmodels.ENTRIES_TABLE)
|
||||||
records := make([]*core.Record, 0, len(adb.Bände.Bände))
|
records := make([]*dbmodels.Entry, 0, len(adb.Bände.Bände))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return records, err
|
return records, err
|
||||||
}
|
}
|
||||||
|
|
||||||
omap := datatypes.MakeMap(adb.Orte.Orte, func(o xmlmodels.Ort) string { return o.ID })
|
|
||||||
relmap := datatypes.MakeMultiMap(
|
|
||||||
adb.Relationen_Bände_Reihen.Relationen,
|
|
||||||
func(r xmlmodels.Relation_Band_Reihe) string { return r.Band },
|
|
||||||
)
|
|
||||||
rmap := datatypes.MakeMap(adb.Reihen.Reihen, func(r xmlmodels.Reihe) string { return r.ID })
|
|
||||||
ocoll, err := app.FindCollectionByNameOrId(dbmodels.PLACES_TABLE)
|
ocoll, err := app.FindCollectionByNameOrId(dbmodels.PLACES_TABLE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.PLACES_TABLE)
|
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.PLACES_TABLE)
|
||||||
return records, err
|
return records, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INFO: lets make some maps to speed this up
|
||||||
|
omap := datatypes.MakeMap(adb.Orte.Orte, func(o xmlmodels.Ort) string { return o.ID })
|
||||||
|
relmap := datatypes.MakeMultiMap(
|
||||||
|
adb.Relationen_Bände_Reihen.Relationen,
|
||||||
|
func(r xmlmodels.Relation_Band_Reihe) string { return r.Band },
|
||||||
|
)
|
||||||
|
rmap := datatypes.MakeMap(adb.Reihen.Reihen, func(r xmlmodels.Reihe) string { return r.ID })
|
||||||
|
|
||||||
for i := 0; i < len(adb.Bände.Bände); i++ {
|
for i := 0; i < len(adb.Bände.Bände); i++ {
|
||||||
band := adb.Bände.Bände[i]
|
band := adb.Bände.Bände[i]
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewEntry(core.NewRecord(collection))
|
||||||
|
|
||||||
// TODO: Hier bevorzugter reihentitel + jahr, oder irgendein reihentitel, oder reihentitelALT
|
// TODO: Hier bevorzugter reihentitel + jahr, oder irgendein reihentitel, oder reihentitelALT
|
||||||
if band.ReihentitelALT == "" {
|
if band.ReihentitelALT == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
record.Set(dbmodels.TITLE_STMT_FIELD, NormalizeString(band.Titelangabe))
|
|
||||||
record.Set(dbmodels.REFERENCES_FIELD, NormalizeString(band.Nachweis))
|
|
||||||
record.Set(dbmodels.ANNOTATION_FIELD, NormalizeString(band.Anmerkungen))
|
|
||||||
if band.Jahr != 0 {
|
|
||||||
record.Set(dbmodels.YEAR_FIELD, band.Jahr)
|
|
||||||
}
|
|
||||||
record.Set(dbmodels.RESPONSIBILITY_STMT_FIELD, NormalizeString(band.Verantwortlichkeitsangabe))
|
|
||||||
record.Set(dbmodels.PUBLICATION_STMT_FIELD, NormalizeString(band.Ortsangabe))
|
|
||||||
record.Set(dbmodels.EXTENT_FIELD, NormalizeString(band.Struktur))
|
|
||||||
|
|
||||||
record.Set(dbmodels.CARRIER_TYPE_FIELD, "Band")
|
record.SetTitleStmt(NormalizeString(band.Titelangabe))
|
||||||
record.Set(dbmodels.CONTENT_TYPE_FIELD, []string{"unbewegtes Bild", "Text"})
|
record.SetReferences(NormalizeString(band.Nachweis))
|
||||||
record.Set(dbmodels.MEDIA_TYPE_FIELD, "ohne Hilfsmittel")
|
record.SetAnnotation(NormalizeString(band.Anmerkungen))
|
||||||
record.Set(dbmodels.LANGUAGE_FIELD, "ger")
|
record.SetResponsibilityStmt(NormalizeString(band.Verantwortlichkeitsangabe))
|
||||||
record.Set(dbmodels.MUSENALMID_FIELD, band.ID)
|
record.SetPublicationStmt(NormalizeString(band.Ortsangabe))
|
||||||
|
record.SetExtent(NormalizeString(band.Struktur))
|
||||||
|
record.SetCarrierType([]string{"Band"})
|
||||||
|
record.SetContentType([]string{"unbewegtes Bild", "Text"})
|
||||||
|
record.SetMediaType([]string{"ohne Hilfsmittel"})
|
||||||
|
record.SetLanguage([]string{"ger"})
|
||||||
|
record.SetMusenalmID(band.ID)
|
||||||
|
|
||||||
|
if band.Jahr != 0 {
|
||||||
|
record.SetYear(band.Jahr)
|
||||||
|
}
|
||||||
|
|
||||||
if band.Erfasst {
|
if band.Erfasst {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
} else if band.Gesichtet {
|
} else if band.Gesichtet {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[2])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[2])
|
||||||
} else if band.BiblioID != 0 {
|
} else if band.BiblioID != 0 {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[1])
|
||||||
} else {
|
} else {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[0])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePreferredTitleEntry(record, band, rmap, relmap)
|
handlePreferredTitleEntry(record, band, rmap, relmap)
|
||||||
@@ -80,15 +83,15 @@ func RecordsFromBände(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handlePreferredTitleEntry(
|
func handlePreferredTitleEntry(
|
||||||
record *core.Record,
|
record *dbmodels.Entry,
|
||||||
band xmlmodels.Band,
|
band xmlmodels.Band,
|
||||||
rmap map[string]xmlmodels.Reihe,
|
rmap map[string]xmlmodels.Reihe,
|
||||||
rrelmap map[string][]xmlmodels.Relation_Band_Reihe,
|
rrelmap map[string][]xmlmodels.Relation_Band_Reihe,
|
||||||
) {
|
) {
|
||||||
rels := rrelmap[band.ID]
|
rels := rrelmap[band.ID]
|
||||||
if len(rels) == 0 {
|
if len(rels) == 0 {
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, NormalizeString(band.ReihentitelALT))
|
record.SetPreferredTitle(NormalizeString(band.ReihentitelALT))
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ func handlePreferredTitleEntry(
|
|||||||
bevti := slices.IndexFunc(rels, func(r xmlmodels.Relation_Band_Reihe) bool { return r.Relation == "1" })
|
bevti := slices.IndexFunc(rels, func(r xmlmodels.Relation_Band_Reihe) bool { return r.Relation == "1" })
|
||||||
if bevti != -1 {
|
if bevti != -1 {
|
||||||
bevt := rmap[rels[bevti].Reihe]
|
bevt := rmap[rels[bevti].Reihe]
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, NormalizeString(bevt.Titel)+" "+jahr)
|
record.SetPreferredTitle(NormalizeString(bevt.Titel) + " " + jahr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +113,11 @@ func handlePreferredTitleEntry(
|
|||||||
return strings.Compare(a.Relation, b.Relation)
|
return strings.Compare(a.Relation, b.Relation)
|
||||||
})
|
})
|
||||||
|
|
||||||
record.Set(dbmodels.PREFERRED_TITLE_FIELD, NormalizeString(rmap[rels[0].Reihe].Titel)+jahr)
|
record.SetPreferredTitle(NormalizeString(rmap[rels[0].Reihe].Titel) + jahr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleOrte(
|
func handleOrte(
|
||||||
record *core.Record,
|
record *dbmodels.Entry,
|
||||||
band xmlmodels.Band,
|
band xmlmodels.Band,
|
||||||
orte map[string]xmlmodels.Ort,
|
orte map[string]xmlmodels.Ort,
|
||||||
app core.App,
|
app core.App,
|
||||||
@@ -132,35 +135,32 @@ func handleOrte(
|
|||||||
|
|
||||||
ort, err := app.FindFirstRecordByData(dbmodels.PLACES_TABLE, dbmodels.PLACES_NAME_FIELD, n)
|
ort, err := app.FindFirstRecordByData(dbmodels.PLACES_TABLE, dbmodels.PLACES_NAME_FIELD, n)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
before := record.GetStringSlice(dbmodels.PLACES_TABLE)
|
before := record.Places()
|
||||||
record.Set(dbmodels.PLACES_TABLE, append(before, ort.Id))
|
record.SetPlaces(append(before, ort.Id))
|
||||||
} else {
|
} else {
|
||||||
orec := core.NewRecord(ocollection)
|
orec := dbmodels.NewPlace(core.NewRecord(ocollection))
|
||||||
orec.Set(dbmodels.PLACES_NAME_FIELD, n)
|
orec.SetName(n)
|
||||||
orec.Set(dbmodels.ANNOTATION_FIELD, o.Anmerkungen)
|
orec.SetAnnotation(o.Anmerkungen)
|
||||||
orec.Set(dbmodels.PLACES_FICTIONAL_FIELD, o.Fiktiv)
|
orec.SetFictional(o.Fiktiv)
|
||||||
orec.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
orec.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
if err := app.Save(orec); err != nil {
|
if err := app.Save(orec); err != nil {
|
||||||
app.Logger().Error("Error saving record", "error", err, "record", orec)
|
app.Logger().Error("Error saving record", "error", err, "record", orec)
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
before := record.GetStringSlice(dbmodels.PLACES_TABLE)
|
before := record.Places()
|
||||||
record.Set(dbmodels.PLACES_TABLE, append(before, orec.Id))
|
record.SetPlaces(append(before, orec.Id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if e {
|
if e {
|
||||||
// INFO: We do not need to get the record metadata here, as we know that the record is new
|
// INFO: We do not need to get the record metadata here, as we know that the record is new
|
||||||
record.Set(
|
record.SetMeta(map[string]dbmodels.MetaData{dbmodels.PLACES_TABLE: {Conjecture: true}})
|
||||||
dbmodels.META_FIELD,
|
|
||||||
map[string]dbmodels.MetaData{dbmodels.PLACES_TABLE: {Conjecture: true}},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleDeprecated(record *core.Record, band xmlmodels.Band) {
|
func handleDeprecated(record *dbmodels.Entry, band xmlmodels.Band) {
|
||||||
depr := dbmodels.Deprecated{
|
depr := dbmodels.Deprecated{
|
||||||
Reihentitel: NormalizeString(band.ReihentitelALT),
|
Reihentitel: NormalizeString(band.ReihentitelALT),
|
||||||
Norm: NormalizeString(band.Norm),
|
Norm: NormalizeString(band.Norm),
|
||||||
@@ -170,5 +170,5 @@ func handleDeprecated(record *core.Record, band xmlmodels.Band) {
|
|||||||
Erfasst: band.Erfasst,
|
Erfasst: band.Erfasst,
|
||||||
}
|
}
|
||||||
|
|
||||||
record.Set(dbmodels.MUSENALM_DEPRECATED_FIELD, depr)
|
record.SetDeprecated(depr)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ func ItemsFromBändeAndBIBLIO(
|
|||||||
app core.App,
|
app core.App,
|
||||||
entries xmlmodels.Bände,
|
entries xmlmodels.Bände,
|
||||||
biblio map[int]xmlmodels.BIBLIOEintrag,
|
biblio map[int]xmlmodels.BIBLIOEintrag,
|
||||||
) ([]*core.Record, error) {
|
) ([]*dbmodels.Item, error) {
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.ITEMS_TABLE)
|
collection, err := app.FindCollectionByNameOrId(dbmodels.ITEMS_TABLE)
|
||||||
records := make([]*core.Record, 0, len(entries.Bände))
|
records := make([]*dbmodels.Item, 0, len(entries.Bände))
|
||||||
r := regexp.MustCompile("\\d{6}")
|
r := regexp.MustCompile("\\d{6}")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
@@ -66,65 +66,63 @@ func ItemsFromBändeAndBIBLIO(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var exemlist []dbmodels.Item
|
|
||||||
|
|
||||||
if band.BiblioID != 0 {
|
if band.BiblioID != 0 {
|
||||||
exem := dbmodels.Item{Identifier: strconv.Itoa(band.BiblioID)}
|
exem := dbmodels.NewItem(core.NewRecord(collection))
|
||||||
|
exem.SetIdentifier(strconv.Itoa(band.BiblioID))
|
||||||
if e, ok := biblio[band.BiblioID]; ok {
|
if e, ok := biblio[band.BiblioID]; ok {
|
||||||
exem.Location = strings.TrimSpace(e.Standort)
|
exem.SetLocation(strings.TrimSpace(e.Standort))
|
||||||
exem.Condition = strings.TrimSpace(e.Zustand)
|
exem.SetCondition(strings.TrimSpace(e.Zustand))
|
||||||
message := ""
|
message := ""
|
||||||
message = appendMessage(e.NotizÄusseres, message)
|
message = appendMessage(e.NotizÄusseres, message)
|
||||||
message = appendMessage(e.NotizInhalt, message)
|
message = appendMessage(e.NotizInhalt, message)
|
||||||
message = appendMessage(e.Anmerkungen, message)
|
message = appendMessage(e.Anmerkungen, message)
|
||||||
exem.Annotation = message
|
exem.SetAnnotation(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
exemlist = append(exemlist, exem)
|
records = append(records, exem)
|
||||||
}
|
}
|
||||||
|
|
||||||
for nr, m := range t {
|
for nr, m := range t {
|
||||||
exem := dbmodels.Item{Identifier: nr}
|
exem := dbmodels.NewItem(core.NewRecord(collection))
|
||||||
|
exem.SetIdentifier(nr)
|
||||||
|
|
||||||
no, err := strconv.Atoi(strings.TrimSpace(nr))
|
no, err := strconv.Atoi(strings.TrimSpace(nr))
|
||||||
message := strings.TrimSpace(m)
|
message := strings.TrimSpace(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if e, ok := biblio[no]; ok {
|
if e, ok := biblio[no]; ok {
|
||||||
exem.Location = strings.TrimSpace(e.Standort)
|
exem.SetLocation(strings.TrimSpace(e.Standort))
|
||||||
exem.Condition = strings.TrimSpace(e.Zustand)
|
exem.SetCondition(strings.TrimSpace(e.Zustand))
|
||||||
message = appendMessage(e.NotizÄusseres, message)
|
message = appendMessage(e.NotizÄusseres, message)
|
||||||
message = appendMessage(e.NotizInhalt, message)
|
message = appendMessage(e.NotizInhalt, message)
|
||||||
message = appendMessage(e.Anmerkungen, message)
|
message = appendMessage(e.Anmerkungen, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exem.Annotation = message
|
exem.SetAnnotation(message)
|
||||||
|
|
||||||
if exem.Identifier != "" {
|
if exem.Identifier() != "" {
|
||||||
exemlist = append(exemlist, exem)
|
records = append(records, exem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(exemlist) > 0 {
|
if len(records) > 0 {
|
||||||
for _, exem := range exemlist {
|
for _, exem := range records {
|
||||||
record := core.NewRecord(collection)
|
exem.SetEntry(banddb.Id)
|
||||||
record.Set(dbmodels.ENTRIES_TABLE, banddb.Id)
|
exem.SetOwner("Theodor Springmann Stiftung")
|
||||||
record.Set(dbmodels.ITEMS_IDENTIFIER_FIELD, exem.Identifier)
|
|
||||||
record.Set(dbmodels.ITEMS_LOCATION_FIELD, exem.Location)
|
|
||||||
record.Set(dbmodels.ITEMS_OWNER_FIELD, "Theodor Springmann Stiftung")
|
|
||||||
record.Set(dbmodels.ITEMS_CONDITION_FIELD, exem.Condition)
|
|
||||||
|
|
||||||
if slices.Contains(band.Status.Value, "Original vorhanden") {
|
if slices.Contains(band.Status.Value, "Original vorhanden") {
|
||||||
record.Set(dbmodels.ITEMS_MEDIA_FIELD, dbmodels.ITEM_TYPE_VALUES[0])
|
exem.SetMedia([]string{dbmodels.ITEM_TYPE_VALUES[0]})
|
||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(band.Status.Value, "Reprint vorhanden") {
|
if slices.Contains(band.Status.Value, "Reprint vorhanden") {
|
||||||
med := record.GetStringSlice(dbmodels.ITEMS_MEDIA_FIELD)
|
med := exem.Media()
|
||||||
record.Set(dbmodels.ITEMS_MEDIA_FIELD, append(med, dbmodels.ITEM_TYPE_VALUES[1]))
|
exem.SetMedia(append(med, dbmodels.ITEM_TYPE_VALUES[1]))
|
||||||
}
|
}
|
||||||
|
|
||||||
record.Set(dbmodels.ANNOTATION_FIELD, exem.Annotation)
|
if exem.Location() == "" {
|
||||||
|
exem.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
||||||
records = append(records, record)
|
} else {
|
||||||
|
exem.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromOrte(app core.App, orte xmlmodels.Orte) ([]*core.Record, error) {
|
func RecordsFromOrte(app core.App, orte xmlmodels.Orte) ([]*dbmodels.Place, error) {
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.PLACES_TABLE)
|
collection, err := app.FindCollectionByNameOrId(dbmodels.PLACES_TABLE)
|
||||||
records := make([]*core.Record, 0, len(orte.Orte))
|
records := make([]*dbmodels.Place, 0, len(orte.Orte))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return records, err
|
return records, err
|
||||||
@@ -18,17 +18,17 @@ func RecordsFromOrte(app core.App, orte xmlmodels.Orte) ([]*core.Record, error)
|
|||||||
|
|
||||||
for i := 0; i < len(orte.Orte); i++ {
|
for i := 0; i < len(orte.Orte); i++ {
|
||||||
ort := orte.Orte[i]
|
ort := orte.Orte[i]
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewPlace(core.NewRecord(collection))
|
||||||
record.Set(dbmodels.PLACES_NAME_FIELD, NormalizeString(ort.Name))
|
record.SetName(NormalizeString(ort.Name))
|
||||||
record.Set(dbmodels.ANNOTATION_FIELD, NormalizeString(ort.Anmerkungen))
|
record.SetAnnotation(NormalizeString(ort.Anmerkungen))
|
||||||
record.Set(dbmodels.PLACES_FICTIONAL_FIELD, ort.Fiktiv)
|
record.SetFictional(ort.Fiktiv)
|
||||||
record.Set(dbmodels.MUSENALMID_FIELD, ort.ID)
|
record.SetMusenalmID(ort.ID)
|
||||||
|
|
||||||
n := ort.Name
|
n := ort.Name
|
||||||
if n == "" {
|
if n == "" {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[1])
|
||||||
} else {
|
} else {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
}
|
}
|
||||||
|
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromRelationInhalteAkteure(app core.App, relations xmlmodels.Relationen_Inhalte_Akteure) ([]*core.Record, error) {
|
func RecordsFromRelationInhalteAkteure(app core.App, relations xmlmodels.Relationen_Inhalte_Akteure) ([]*dbmodels.RContentsAgents, error) {
|
||||||
records := make([]*core.Record, 0, len(relations.Relationen))
|
records := make([]*dbmodels.RContentsAgents, 0, len(relations.Relationen))
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.RelationTableName(dbmodels.CONTENTS_TABLE, dbmodels.AGENTS_TABLE))
|
collection, err := app.FindCollectionByNameOrId(dbmodels.RelationTableName(dbmodels.CONTENTS_TABLE, dbmodels.AGENTS_TABLE))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.RelationTableName(dbmodels.CONTENTS_TABLE, dbmodels.AGENTS_TABLE))
|
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.RelationTableName(dbmodels.CONTENTS_TABLE, dbmodels.AGENTS_TABLE))
|
||||||
@@ -18,27 +18,29 @@ func RecordsFromRelationInhalteAkteure(app core.App, relations xmlmodels.Relatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, relation := range relations.Relationen {
|
for _, relation := range relations.Relationen {
|
||||||
content, err := app.FindFirstRecordByData(dbmodels.CONTENTS_TABLE, dbmodels.MUSENALMID_FIELD, relation.Inhalt)
|
c, err := app.FindFirstRecordByData(dbmodels.CONTENTS_TABLE, dbmodels.MUSENALMID_FIELD, relation.Inhalt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding Inhalt", "error", err, "relation", relation)
|
app.Logger().Error("Error finding Inhalt", "error", err, "relation", relation)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
content := dbmodels.NewContent(c)
|
||||||
|
|
||||||
agent, err := app.FindFirstRecordByData(dbmodels.AGENTS_TABLE, dbmodels.MUSENALMID_FIELD, relation.Akteur)
|
a, err := app.FindFirstRecordByData(dbmodels.AGENTS_TABLE, dbmodels.MUSENALMID_FIELD, relation.Akteur)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding Content", "error", err, "relation", relation)
|
app.Logger().Error("Error finding Content", "error", err, "relation", relation)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
agent := dbmodels.NewAgent(a)
|
||||||
|
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewRContentsAgents(core.NewRecord(collection))
|
||||||
record.Set(dbmodels.CONTENTS_TABLE, content.Id)
|
record.SetContent(content.Id)
|
||||||
record.Set(dbmodels.AGENTS_TABLE, agent.Id)
|
record.SetAgent(agent.Id)
|
||||||
|
|
||||||
switch relation.Relation {
|
switch relation.Relation {
|
||||||
case "1":
|
case "1":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Schöpfer")
|
record.SetType("Schöpfer")
|
||||||
cat := content.GetStringSlice(dbmodels.MUSENALM_INHALTE_TYPE_FIELD)
|
cat := content.MusenalmType()
|
||||||
ber := agent.GetString(dbmodels.AGENTS_PROFESSION_FIELD)
|
ber := agent.Profession()
|
||||||
probt := 0
|
probt := 0
|
||||||
probm := 0
|
probm := 0
|
||||||
probg := 0
|
probg := 0
|
||||||
@@ -81,32 +83,32 @@ func RecordsFromRelationInhalteAkteure(app core.App, relations xmlmodels.Relatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
if probt == 3 && probm <= 1 && probg <= 1 {
|
if probt == 3 && probm <= 1 && probg <= 1 {
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Autor:in")
|
record.SetType("Autor:in")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if probm == 3 && probt <= 1 && probg <= 1 {
|
if probm == 3 && probt <= 1 && probg <= 1 {
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Komponist:in")
|
record.SetType("Komponist:in")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if probg == 3 && probt <= 1 && probm <= 1 {
|
if probg == 3 && probt <= 1 && probm <= 1 {
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Künstler:in")
|
record.SetType("Künstler:in")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Schöpfer")
|
record.SetType("Schöpfer")
|
||||||
case "2":
|
case "2":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Autor:in")
|
record.SetType("Autor:in")
|
||||||
case "3":
|
case "3":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Zeichner:in")
|
record.SetType("Herausgeber:in")
|
||||||
case "4":
|
case "4":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Kupferstecher:in")
|
record.SetType("Verlag")
|
||||||
}
|
}
|
||||||
|
|
||||||
rel := record.GetString(dbmodels.RELATION_TYPE_FIELD)
|
rel := record.Type()
|
||||||
ent := record.GetString(dbmodels.CONTENTS_TABLE)
|
ent := record.Content()
|
||||||
ser := record.GetString(dbmodels.AGENTS_TABLE)
|
ser := record.Agent()
|
||||||
|
|
||||||
if strings.TrimSpace(rel) == "" || strings.TrimSpace(ent) == "" || strings.TrimSpace(ser) == "" {
|
if strings.TrimSpace(rel) == "" || strings.TrimSpace(ent) == "" || strings.TrimSpace(ser) == "" {
|
||||||
content.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
content.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromRelationBändeAkteure(app core.App, relations xmlmodels.Relationen_Bände_Akteure) ([]*core.Record, error) {
|
func RecordsFromRelationBändeAkteure(app core.App, relations xmlmodels.Relationen_Bände_Akteure) ([]*dbmodels.REntriesAgents, error) {
|
||||||
records := make([]*core.Record, 0, len(relations.Relationen))
|
records := make([]*dbmodels.REntriesAgents, 0, len(relations.Relationen))
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.RelationTableName(dbmodels.ENTRIES_TABLE, dbmodels.AGENTS_TABLE))
|
collection, err := app.FindCollectionByNameOrId(dbmodels.RelationTableName(dbmodels.ENTRIES_TABLE, dbmodels.AGENTS_TABLE))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.RelationTableName(dbmodels.CONTENTS_TABLE, dbmodels.AGENTS_TABLE))
|
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.RelationTableName(dbmodels.CONTENTS_TABLE, dbmodels.AGENTS_TABLE))
|
||||||
@@ -29,28 +29,29 @@ func RecordsFromRelationBändeAkteure(app core.App, relations xmlmodels.Relation
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewREntriesAgents(core.NewRecord(collection))
|
||||||
record.Set(dbmodels.ENTRIES_TABLE, entry.Id)
|
record.SetEntry(entry.Id)
|
||||||
record.Set(dbmodels.AGENTS_TABLE, agent.Id)
|
record.SetAgent(agent.Id)
|
||||||
|
|
||||||
switch relation.Relation {
|
switch relation.Relation {
|
||||||
case "8":
|
case "8":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Vertrieb")
|
record.SetType("Vertrieb")
|
||||||
case "7":
|
case "7":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Druck")
|
record.SetType("Druck")
|
||||||
case "6":
|
case "6":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Verlag")
|
record.SetType("Verlag")
|
||||||
case "5":
|
case "5":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Herausgeber:in")
|
record.SetType("Herausgeber:in")
|
||||||
}
|
}
|
||||||
|
|
||||||
rel := record.GetString(dbmodels.RELATION_TYPE_FIELD)
|
rel := record.Type()
|
||||||
ent := record.GetString(dbmodels.ENTRIES_TABLE)
|
ent := record.Entry()
|
||||||
ser := record.GetString(dbmodels.AGENTS_TABLE)
|
ser := record.Agent()
|
||||||
|
|
||||||
if strings.TrimSpace(rel) == "" || strings.TrimSpace(ent) == "" || strings.TrimSpace(ser) == "" {
|
if strings.TrimSpace(rel) == "" || strings.TrimSpace(ent) == "" || strings.TrimSpace(ser) == "" {
|
||||||
entry.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
e := dbmodels.NewEntry(entry)
|
||||||
_ = app.Save(entry)
|
e.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
||||||
|
_ = app.Save(e)
|
||||||
}
|
}
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromRelationBändeReihen(app core.App, relations xmlmodels.Relationen_Bände_Reihen) ([]*core.Record, error) {
|
func RecordsFromRelationBändeReihen(app core.App, relations xmlmodels.Relationen_Bände_Reihen) ([]*dbmodels.REntriesSeries, error) {
|
||||||
records := make([]*core.Record, 0, len(relations.Relationen))
|
records := make([]*dbmodels.REntriesSeries, 0, len(relations.Relationen))
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.RelationTableName(dbmodels.ENTRIES_TABLE, dbmodels.SERIES_TABLE))
|
collection, err := app.FindCollectionByNameOrId(dbmodels.RelationTableName(dbmodels.ENTRIES_TABLE, dbmodels.SERIES_TABLE))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.RelationTableName(dbmodels.ENTRIES_TABLE, dbmodels.SERIES_TABLE))
|
app.Logger().Error("Error finding collection", "error", err, "collection", dbmodels.RelationTableName(dbmodels.ENTRIES_TABLE, dbmodels.SERIES_TABLE))
|
||||||
@@ -17,47 +17,49 @@ func RecordsFromRelationBändeReihen(app core.App, relations xmlmodels.Relatione
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, relation := range relations.Relationen {
|
for _, relation := range relations.Relationen {
|
||||||
entry, err := app.FindFirstRecordByData(dbmodels.ENTRIES_TABLE, dbmodels.MUSENALMID_FIELD, relation.Band)
|
e, err := app.FindFirstRecordByData(dbmodels.ENTRIES_TABLE, dbmodels.MUSENALMID_FIELD, relation.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding Entry", "error", err, "relation", relation)
|
app.Logger().Error("Error finding Entry", "error", err, "relation", relation)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entry := dbmodels.NewEntry(e)
|
||||||
|
|
||||||
series, err := app.FindFirstRecordByData(dbmodels.SERIES_TABLE, dbmodels.MUSENALMID_FIELD, relation.Reihe)
|
series, err := app.FindFirstRecordByData(dbmodels.SERIES_TABLE, dbmodels.MUSENALMID_FIELD, relation.Reihe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Logger().Error("Error finding Series", "error", err, "relation", relation)
|
app.Logger().Error("Error finding Series", "error", err, "relation", relation)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewREntriesSeries(core.NewRecord(collection))
|
||||||
record.Set(dbmodels.ENTRIES_TABLE, entry.Id)
|
record.SetEntry(entry.Id)
|
||||||
record.Set(dbmodels.SERIES_TABLE, series.Id)
|
record.SetSeries(series.Id)
|
||||||
|
|
||||||
switch relation.Relation {
|
switch relation.Relation {
|
||||||
case "1":
|
case "1":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Bevorzugter Reihentitel")
|
record.SetType("Bevorzugter Reihentitel")
|
||||||
case "2":
|
case "2":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Alternativer Reihentitel")
|
record.SetType("Alternativer Reihentitel")
|
||||||
case "3":
|
case "3":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "In anderer Sprache")
|
record.SetType("In anderer Sprache")
|
||||||
case "4":
|
case "4":
|
||||||
entry.Set(dbmodels.LANGUAGE_FIELD, "fre")
|
entry.SetLanguage([]string{"fre"})
|
||||||
_ = app.Save(entry)
|
_ = app.Save(entry)
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "In anderer Sprache")
|
record.SetType("In anderer Sprache")
|
||||||
case "5":
|
case "5":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Alternativer Reihentitel")
|
record.SetType("Alternativer Reihentitel")
|
||||||
case "6":
|
case "6":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Früherer Reihentitel")
|
record.SetType("Früherer Reihentitel")
|
||||||
case "7":
|
case "7":
|
||||||
record.Set(dbmodels.RELATION_TYPE_FIELD, "Späterer Reihentitel")
|
record.SetType("Späterer Reihentitel")
|
||||||
}
|
}
|
||||||
|
|
||||||
rel := record.GetString(dbmodels.RELATION_TYPE_FIELD)
|
rel := record.Type()
|
||||||
ent := record.GetString(dbmodels.ENTRIES_TABLE)
|
ent := record.Entry()
|
||||||
ser := record.GetString(dbmodels.SERIES_TABLE)
|
ser := record.Series()
|
||||||
|
|
||||||
if strings.TrimSpace(rel) == "" || strings.TrimSpace(ent) == "" || strings.TrimSpace(ser) == "" {
|
if strings.TrimSpace(rel) == "" || strings.TrimSpace(ent) == "" || strings.TrimSpace(ser) == "" {
|
||||||
entry.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
entry.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-2])
|
||||||
_ = app.Save(entry)
|
_ = app.Save(entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,33 +8,33 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RecordsFromReihentitel(app core.App, reihen xmlmodels.Reihentitel) ([]*core.Record, error) {
|
func RecordsFromReihentitel(app core.App, reihen xmlmodels.Reihentitel) ([]*dbmodels.Series, error) {
|
||||||
collection, err := app.FindCollectionByNameOrId(dbmodels.SERIES_TABLE)
|
collection, err := app.FindCollectionByNameOrId(dbmodels.SERIES_TABLE)
|
||||||
records := make([]*core.Record, 0, len(reihen.Reihen))
|
records := make([]*dbmodels.Series, 0, len(reihen.Reihen))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return records, err
|
return records, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < len(reihen.Reihen); i++ {
|
for i := 0; i < len(reihen.Reihen); i++ {
|
||||||
record := core.NewRecord(collection)
|
record := dbmodels.NewSeries(core.NewRecord(collection))
|
||||||
reihe := reihen.Reihen[i]
|
reihe := reihen.Reihen[i]
|
||||||
if reihe.Titel == "" {
|
if reihe.Titel == "" {
|
||||||
record.Set(dbmodels.SERIES_NAME_FIELD, reihe.Sortiername)
|
record.SetTitle(NormalizeString(reihe.Sortiername))
|
||||||
} else {
|
} else {
|
||||||
record.Set(dbmodels.SERIES_NAME_FIELD, reihe.Titel)
|
record.SetTitle(NormalizeString(reihe.Titel))
|
||||||
}
|
}
|
||||||
|
|
||||||
record.Set(dbmodels.REFERENCES_FIELD, NormalizeString(reihe.Nachweis))
|
record.SetReferences(NormalizeString(reihe.Nachweis))
|
||||||
record.Set(dbmodels.ANNOTATION_FIELD, NormalizeString(reihe.Anmerkungen))
|
record.SetAnnotation(NormalizeString(reihe.Anmerkungen))
|
||||||
record.Set(dbmodels.SERIES_FREQUENCY_FIELD, "jährlich")
|
record.SetFrequency("jährlich")
|
||||||
record.Set(dbmodels.MUSENALMID_FIELD, reihe.ID)
|
record.SetMusenalmID(reihe.ID)
|
||||||
|
|
||||||
n := record.GetString(dbmodels.SERIES_NAME_FIELD)
|
n := record.Title()
|
||||||
if n == "" {
|
if n == "" {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[1])
|
||||||
} else {
|
} else {
|
||||||
record.Set(dbmodels.EDITSTATE_FIELD, dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
record.SetEditState(dbmodels.EDITORSTATE_VALUES[len(dbmodels.EDITORSTATE_VALUES)-1])
|
||||||
}
|
}
|
||||||
|
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
|
|||||||
Reference in New Issue
Block a user