feat: update

This commit is contained in:
Rogee
2025-05-23 23:42:27 +08:00
parent 409a2e8304
commit 1166a5c949
17 changed files with 751 additions and 514 deletions

View File

@@ -3,7 +3,6 @@ package admin
import (
"quyun/app/model"
"quyun/app/requests"
"quyun/database/conds"
"quyun/database/fields"
"github.com/gofiber/fiber/v3"
@@ -23,10 +22,10 @@ type posts struct{}
// @Bind pagination query
// @Bind query query
func (ctl *posts) List(ctx fiber.Ctx, pagination *requests.Pagination, query *ListQuery) (*requests.Pager, error) {
conds := []conds.Cond{
conds := []model.Cond{
// conds.Post_NotDeleted(),
// conds.Post_Status(fields.PostStatusPublished),
conds.Post_Like(query.Keyword),
model.PostsModel().CondLike(query.Keyword),
}
pager, err := model.PostsModel().List(ctx.Context(), pagination, conds...)
if err != nil {
@@ -158,7 +157,7 @@ func (ctl *posts) Delete(ctx fiber.Ctx, id int64) error {
return fiber.ErrNotFound
}
if err := post.Delete(ctx.Context()); err != nil {
if err := post.ForceDelete(ctx.Context()); err != nil {
return err
}
return nil