v1 blog API routes

This commit is contained in:
ari melody 2025-11-07 19:31:34 +00:00
parent fec3325503
commit eaa2f6587d
Signed by: ari
GPG key ID: CF99829C92678188
9 changed files with 286 additions and 34 deletions

View file

@ -93,3 +93,18 @@ func UpdateBlogPost(db *sqlx.DB, postID string, post *model.BlogPost) error {
return err
}
func DeleteBlogPost(db *sqlx.DB, postID string) (int64, error) {
result, err := db.Exec(
"DELETE FROM blogpost "+
"WHERE id=$1",
postID,
)
if err != nil {
return 0, err
}
rowsAffected, _ := result.RowsAffected()
return rowsAffected, nil
}