Blog deletion

This commit is contained in:
Caleb Gardner
2024-12-27 00:28:34 -06:00
parent aa180ae67e
commit 1229be1cee
4 changed files with 55 additions and 3 deletions
+5
View File
@@ -262,6 +262,11 @@ func (b *BlogApp) UpdateBlog(ctx context.Context, ID string, updates bson.M) err
return err
}
func (b *BlogApp) RemoveBlog(ctx context.Context, ID string) error {
_, err := b.blogCol.DeleteOne(ctx, bson.M{"_id": ID})
return err
}
func (b *BlogApp) LatestBlogs(ctx context.Context, page int64) ([]*Blog, error) {
res, err := b.blogCol.Find(ctx, bson.M{"staticPage": false, "draft": false}, options.Find().
SetSort(bson.M{"createTime": -1}).