mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Erste Experimente mit Reihen
This commit is contained in:
50
pages/migrations_reihen/1739446703_insert_data_reihen.go
Normal file
50
pages/migrations_reihen/1739446703_insert_data_reihen.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package migrations_reihen
|
||||
|
||||
import (
|
||||
"github.com/Theodor-Springmann-Stiftung/musenalm/pagemodels"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/tools/filesystem"
|
||||
)
|
||||
|
||||
const START = "<p>Ziel der Musenalm ist die bibliographische Erfassung eines Jahrhunderts deutscher Almanache und Taschenbücher;<strong> </strong>das Projekt ist im Aufbau und wird kontinuierlich weitergeführt.</p><p>Verzeichnet werden:</p><ul><li><strong>Reihen </strong>und<strong> Bände</strong> bekannter Almanache und einzelne Druckauflagen mit ausführlichen bibliographischen Angaben und kurzer systematisierter <strong>Darstellung ihres strukturellen Aufbaus </strong> (Paginierung, Anordnung der Druckteile, Graphiken und Beilagen),<strong><br></strong></li><li><strong>Beiträge literarisch oder musisch ausgerichteter Almanache </strong>einzeln, nach Autor, Überschrift und Incipit,<strong> </strong>inklusive<strong> Digitalisate </strong>graphischer und musischer Beiträge,</li><li>Beiträge vorwiegend <strong>nicht literarischer Almanache</strong> in der Regel durch Wiedergabe des <strong>Inhaltsverzeichnisses.</strong></li></ul><p>Die Bibliographie ist zugänglich mit umfangreichen Suchfunktionen über:</p><ul><li><strong>Reihentitel der Almanache,</strong></li><li><strong>Abbildungen (Graphiken und Musikbeilagen),</strong></li><li>Personennamen von Herausgebern und Beiträgern einerseits über normierte<strong> Realnamen </strong>und andererseits über die im Druck erscheinenden Schreibweisen der Personen (auch Pseudonyme)<strong> </strong>als<strong> Autornamen,</strong></li><li><strong>Einzeltitel und Incipit </strong>(wörtliche Textanfänge) von Beiträgen.</li></ul><p>Die Musenalm ist ein Projekt der Theodor Springmann Stiftung in Heidelberg.</p>"
|
||||
|
||||
const START_BILD = "./Static-Bilder/musen.png"
|
||||
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId(
|
||||
pagemodels.GeneratePageTableName(pagemodels.P_REIHEN_NAME))
|
||||
if err != nil {
|
||||
app.Logger().Error("Could not find Table Reihen! You need to execute table migrations first!")
|
||||
return err
|
||||
}
|
||||
|
||||
record := pagemodels.NewReihen(core.NewRecord(collection))
|
||||
record.SetTitle("Musenalm")
|
||||
record.SetText(START)
|
||||
|
||||
img, err := filesystem.NewFileFromPath(START_BILD)
|
||||
if err != nil {
|
||||
app.Logger().Error("Failed to read image file", "error", err, "path", START_BILD)
|
||||
return err
|
||||
}
|
||||
|
||||
record.SetImage(img)
|
||||
|
||||
if err := app.Save(record); err != nil {
|
||||
app.Logger().Error("Failed to save record", "error", err, "record", record)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, func(app core.App) error {
|
||||
coll, err := app.FindCollectionByNameOrId(
|
||||
pagemodels.GeneratePageTableName(pagemodels.P_REIHEN_NAME))
|
||||
|
||||
if err == nil && coll != nil {
|
||||
app.DB().NewQuery("DELETE FROM " + coll.TableName()).Execute()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user