mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Reihen Page -- all kinds of stuff
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
package dbmodels
|
||||
|
||||
import "github.com/pocketbase/pocketbase/core"
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"golang.org/x/text/collate"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
var _ core.RecordProxy = (*Agent)(nil)
|
||||
|
||||
@@ -109,3 +115,10 @@ func (a *Agent) SetEditState(editState string) {
|
||||
func (a *Agent) Comment() string {
|
||||
return a.GetString(COMMENT_FIELD)
|
||||
}
|
||||
|
||||
func SortAgentsByName(series []*Agent) {
|
||||
collator := collate.New(language.German)
|
||||
slices.SortFunc(series, func(i, j *Agent) int {
|
||||
return collator.CompareString(i.Name(), j.Name())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -81,3 +81,15 @@ func BasicRelationCollection(app core.App, sourcetablename, targettablename stri
|
||||
|
||||
return collection, nil
|
||||
}
|
||||
|
||||
type IDable interface {
|
||||
ID() string
|
||||
}
|
||||
|
||||
func GetIDs(records []IDable) []string {
|
||||
ids := []string{}
|
||||
for _, r := range records {
|
||||
ids = append(ids, r.ID())
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ func NewSeries(record *core.Record) *Series {
|
||||
return i
|
||||
}
|
||||
|
||||
func (s Series) ID() string {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *Series) TableName() string {
|
||||
return SERIES_TABLE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user