mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 01:05:32 +00:00
157 lines
3.1 KiB
Go
157 lines
3.1 KiB
Go
package dbmodels
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"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) ProfessionArray() []string {
|
|
profession := a.Profession()
|
|
if profession == "" {
|
|
return []string{}
|
|
}
|
|
|
|
ret := []string{}
|
|
profarr := strings.Split(profession, " ")
|
|
for _, p := range profarr {
|
|
if p == "" {
|
|
continue
|
|
}
|
|
plow := strings.ToLower(p)
|
|
if strings.Contains(plow, "text") {
|
|
ret = append(ret, "Text")
|
|
} else if strings.Contains(plow, "musik") {
|
|
ret = append(ret, "Musik")
|
|
} else if strings.Contains(plow, "graphik") {
|
|
ret = append(ret, "Graphik")
|
|
} else if strings.Contains(plow, "hrsg") {
|
|
ret = append(ret, "Hrsg")
|
|
} else if strings.Contains(plow, "sonst") {
|
|
ret = append(ret, "Sonst")
|
|
}
|
|
}
|
|
|
|
return ret
|
|
}
|
|
|
|
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() int {
|
|
return a.GetInt(MUSENALMID_FIELD)
|
|
}
|
|
|
|
func (a *Agent) SetMusenalmID(id int) {
|
|
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)
|
|
}
|
|
|
|
func (a *Agent) SetComment(comments string) {
|
|
a.Set(COMMENT_FIELD, comments)
|
|
}
|
|
|
|
func (a *Agent) Editor() string {
|
|
return a.GetString(EDITOR_FIELD)
|
|
}
|
|
|
|
func (a *Agent) SetEditor(editor string) {
|
|
a.Set(EDITOR_FIELD, editor)
|
|
}
|