From 2dc62e58b4b45d965c8247bbca4cdedfc59e63e8 Mon Sep 17 00:00:00 2001 From: phucledien Date: Thu, 25 Jan 2024 17:26:52 +0700 Subject: [PATCH] fix(changelog): add field seo to changelog --- docs/docs.go | 3 +++ docs/swagger.json | 3 +++ docs/swagger.yaml | 2 ++ ...125172303-add-seo-description-to-changelogs-table.sql | 9 +++++++++ pkg/entities/product_data.go | 4 +++- pkg/model/product_bot_commands.go | 1 + 6 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 migrations/schemas/20240125172303-add-seo-description-to-changelogs-table.sql diff --git a/docs/docs.go b/docs/docs.go index c006c5aa..bbe33238 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -7696,6 +7696,9 @@ const docTemplate = `{ "product": { "type": "string" }, + "seo_description": { + "type": "string" + }, "thumbnail_url": { "type": "string" }, diff --git a/docs/swagger.json b/docs/swagger.json index e9b48ac8..37dae457 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -7688,6 +7688,9 @@ "product": { "type": "string" }, + "seo_description": { + "type": "string" + }, "thumbnail_url": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0478ddcc..fc1f88cf 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -726,6 +726,8 @@ definitions: type: string product: type: string + seo_description: + type: string thumbnail_url: type: string title: diff --git a/migrations/schemas/20240125172303-add-seo-description-to-changelogs-table.sql b/migrations/schemas/20240125172303-add-seo-description-to-changelogs-table.sql new file mode 100644 index 00000000..8c301226 --- /dev/null +++ b/migrations/schemas/20240125172303-add-seo-description-to-changelogs-table.sql @@ -0,0 +1,9 @@ +-- +migrate Up +ALTER TABLE + product_changelogs +ADD + COLUMN seo_description TEXT; + +-- +migrate Down +ALTER TABLE + product_changelogs DROP COLUMN seo_description; \ No newline at end of file diff --git a/pkg/entities/product_data.go b/pkg/entities/product_data.go index 809219b2..25441ebe 100644 --- a/pkg/entities/product_data.go +++ b/pkg/entities/product_data.go @@ -10,12 +10,12 @@ import ( "github.com/bwmarrin/discordgo" "github.com/consolelabs/mochi-typeset/typeset" - "github.com/defipod/mochi/pkg/kafka/message" "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/text" "gorm.io/gorm" + "github.com/defipod/mochi/pkg/kafka/message" "github.com/defipod/mochi/pkg/logger" "github.com/defipod/mochi/pkg/model" "github.com/defipod/mochi/pkg/model/errors" @@ -202,6 +202,8 @@ func (e *Entity) parseChangelogsContent(content string) *model.ProductChangelogs changelogs.ThumbnailUrl = strings.TrimSpace(cRow[1]) case "field_version": changelogs.Version = strings.TrimSpace(cRow[1]) + case "seo_description": + changelogs.SeoDescription = strings.TrimSpace(cRow[1]) } } diff --git a/pkg/model/product_bot_commands.go b/pkg/model/product_bot_commands.go index 6af4af9d..12f4a008 100644 --- a/pkg/model/product_bot_commands.go +++ b/pkg/model/product_bot_commands.go @@ -29,6 +29,7 @@ type ProductChangelogs struct { FileName string `json:"file_name"` IsExpired bool `json:"is_expired"` Version string `json:"version"` + SeoDescription string `json:"seo_description"` NextVersion string `json:"next_version" gorm:"-"` PreviousVersion string `json:"previous_version" gorm:"-"` CreatedAt time.Time `json:"created_at"`