Places, Agents, Serials, Entries

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

28
migrations/seed/common.go Normal file
View File

@@ -0,0 +1,28 @@
package seed
import (
"strings"
"github.com/pocketbase/pocketbase/core"
)
func NormalizeString(s string) string {
s = strings.TrimSpace(s)
s = strings.ReplaceAll(s, "<div>", "")
s = strings.ReplaceAll(s, "</div>", "")
return s
}
func batchSave(app core.App, records []*core.Record) error {
app.RunInTransaction(func(txapp core.App) error {
for _, record := range records {
if err := txapp.Save(record); err != nil {
app.Logger().Error("Error saving record.", "error", err, "record", record)
continue
}
}
return nil
})
return nil
}