Skip to content

Commit

Permalink
feat: 在文章添加和更新处理逻辑中添加封面字段支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Redish101 committed Feb 7, 2025
1 parent 735ea41 commit 38fd529
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/handler/article_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func ArticleAdd(app *core.App, router fiber.Router) {
Slug: params.Slug,
Desc: params.Desc,
Content: params.Content,
Cover: &params.Cover,
Draft: &params.Draft,
}

Expand Down
3 changes: 2 additions & 1 deletion server/handler/article_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type ArticleUpdateParams struct {
Slug string `json:"slug" validate:"required"`
Title string `json:"title" validate:"required"`
Desc string `json:"desc" validate:"required"`
Cover string `json:"cover"`
Cover string `json:"cover"`
Content string `json:"content" validate:"required"`
Draft bool `json:"draft"`
}
Expand Down Expand Up @@ -52,6 +52,7 @@ func ArticleUpdate(app *core.App, router fiber.Router) {
_, err = a.Where(a.Slug.Eq(params.Slug)).Updates(model.Article{
Title: params.Title,
Desc: params.Desc,
Cover: &params.Cover,
Content: params.Content,
Draft: &params.Draft,
})
Expand Down

0 comments on commit 38fd529

Please sign in to comment.