mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
+Inhalte edit page
This commit is contained in:
@@ -67,3 +67,18 @@ func nextPlaceMusenalmID(app core.App) (int, error) {
|
||||
}
|
||||
return place.MusenalmID() + 1, nil
|
||||
}
|
||||
|
||||
func nextContentMusenalmID(app core.App) (int, error) {
|
||||
var content dbmodels.Content
|
||||
err := app.RecordQuery(dbmodels.CONTENTS_TABLE).
|
||||
OrderBy(dbmodels.MUSENALMID_FIELD + " DESC").
|
||||
Limit(1).
|
||||
One(&content)
|
||||
if err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return 1, nil
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
return content.MusenalmID() + 1, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user