From 6e146845399f99705064e3da1e90a473facf710b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 11 Aug 2024 01:22:55 +0800 Subject: [PATCH] :sparkles: Thumbnail --- pkg/internal/models/posts.go | 2 ++ pkg/internal/server/api/articles_api.go | 4 ++++ pkg/internal/server/api/stories_api.go | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/pkg/internal/models/posts.go b/pkg/internal/models/posts.go index b817745..8b43b20 100644 --- a/pkg/internal/models/posts.go +++ b/pkg/internal/models/posts.go @@ -60,6 +60,7 @@ type Post struct { } type PostStoryBody struct { + Thumbnail *uint `json:"thumbnail"` Title *string `json:"title"` Content string `json:"content"` Location *string `json:"location"` @@ -67,6 +68,7 @@ type PostStoryBody struct { } type PostArticleBody struct { + Thumbnail *uint `json:"thumbnail"` Title string `json:"title"` Description *string `json:"description"` Content string `json:"content"` diff --git a/pkg/internal/server/api/articles_api.go b/pkg/internal/server/api/articles_api.go index 7eb5161..d551505 100644 --- a/pkg/internal/server/api/articles_api.go +++ b/pkg/internal/server/api/articles_api.go @@ -24,6 +24,7 @@ func createArticle(c *fiber.Ctx) error { Title string `json:"title" validate:"required,max=1024"` Description *string `json:"description"` Content string `json:"content" validate:"required"` + Thumbnail *uint `json:"thumbnail"` Attachments []uint `json:"attachments"` Tags []models.Tag `json:"tags"` Categories []models.Category `json:"categories"` @@ -41,6 +42,7 @@ func createArticle(c *fiber.Ctx) error { } body := models.PostArticleBody{ + Thumbnail: data.Thumbnail, Title: data.Title, Description: data.Description, Content: data.Content, @@ -104,6 +106,7 @@ func editArticle(c *fiber.Ctx) error { Title string `json:"title" validate:"required,max=1024"` Description *string `json:"description"` Content string `json:"content" validate:"required"` + Thumbnail *uint `json:"thumbnail"` Attachments []uint `json:"attachments"` Tags []models.Tag `json:"tags"` Categories []models.Category `json:"categories"` @@ -143,6 +146,7 @@ func editArticle(c *fiber.Ctx) error { } body := models.PostArticleBody{ + Thumbnail: data.Thumbnail, Title: data.Title, Description: data.Description, Content: data.Content, diff --git a/pkg/internal/server/api/stories_api.go b/pkg/internal/server/api/stories_api.go index d6771fb..215e327 100644 --- a/pkg/internal/server/api/stories_api.go +++ b/pkg/internal/server/api/stories_api.go @@ -24,6 +24,7 @@ func createStory(c *fiber.Ctx) error { Title *string `json:"title"` Content string `json:"content" validate:"required,max=4096"` Location *string `json:"location"` + Thumbnail *uint `json:"thumbnail"` Attachments []uint `json:"attachments"` Tags []models.Tag `json:"tags"` Categories []models.Category `json:"categories"` @@ -43,6 +44,7 @@ func createStory(c *fiber.Ctx) error { } body := models.PostStoryBody{ + Thumbnail: data.Thumbnail, Title: data.Title, Content: data.Content, Location: data.Location, @@ -122,6 +124,7 @@ func editStory(c *fiber.Ctx) error { var data struct { Title *string `json:"title"` Content string `json:"content" validate:"required,max=4096"` + Thumbnail *uint `json:"thumbnail"` Location *string `json:"location"` Attachments []uint `json:"attachments"` Tags []models.Tag `json:"tags"` @@ -162,6 +165,7 @@ func editStory(c *fiber.Ctx) error { } body := models.PostStoryBody{ + Thumbnail: data.Thumbnail, Title: data.Title, Content: data.Content, Location: data.Location,