add endpoints to update article status
Signed-off-by: Tobias Erbshäußer <tobias@tesoft.dev>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user