add endpoints to update article status

Signed-off-by: Tobias Erbshäußer <tobias@tesoft.dev>
This commit is contained in:
2026-05-24 09:22:33 +02:00
parent 712d92b810
commit 6b237a1417
3 changed files with 66 additions and 0 deletions
+18
View File
@@ -304,6 +304,24 @@ func (db *Database) GetBlogArticleFile(showAll bool, articleId int64, fileId int
}, nil
}
func (db *Database) SetBlogArticleStatus(id int64, status ArticleStatus) error {
res, err := db.db.Exec("UPDATE blog_article SET status = ? WHERE id = ?", status, id)
if err != nil {
return err
}
affected, err := res.RowsAffected()
if err != nil {
return err
}
if affected == 0 {
return ErrNotFound
}
return nil
}
func migrate(db *sql.DB, rootPassword string) error {
tx, err := db.Begin()
if err != nil {