mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
BUGFIX: keep fts5 tables syncronized
This commit is contained in:
@@ -214,6 +214,18 @@ func (p *AlmanachEditPage) POSTSave(engine *templating.Engine, app core.App) Han
|
||||
})
|
||||
}
|
||||
|
||||
// Update FTS5 index asynchronously
|
||||
go func(appInstance core.App, entryID string) {
|
||||
freshEntry, err := dbmodels.Entries_ID(appInstance, entryID)
|
||||
if err != nil {
|
||||
appInstance.Logger().Error("Failed to load entry for FTS5 update", "entry_id", entryID, "error", err)
|
||||
return
|
||||
}
|
||||
if err := updateEntryFTS5(appInstance, freshEntry); err != nil {
|
||||
appInstance.Logger().Error("Failed to update FTS5 index for entry", "entry_id", entryID, "error", err)
|
||||
}
|
||||
}(app, entry.Id)
|
||||
|
||||
freshEntry, err := dbmodels.Entries_MusenalmID(app, id)
|
||||
if err == nil {
|
||||
entry = freshEntry
|
||||
@@ -297,6 +309,13 @@ func (p *AlmanachEditPage) POSTDelete(engine *templating.Engine, app core.App) H
|
||||
})
|
||||
}
|
||||
|
||||
// Delete from FTS5 index asynchronously
|
||||
go func(appInstance core.App, entryID string) {
|
||||
if err := dbmodels.DeleteFTS5Entry(appInstance, entryID); err != nil {
|
||||
appInstance.Logger().Error("Failed to delete FTS5 entry", "entry_id", entryID, "error", err)
|
||||
}
|
||||
}(app, entry.Id)
|
||||
|
||||
return e.JSON(http.StatusOK, map[string]any{
|
||||
"success": true,
|
||||
"redirect": "/suche/baende",
|
||||
|
||||
Reference in New Issue
Block a user