From 74e55bc19d92ddff6ea1c8a21e46f4ed16d4e780 Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Thu, 7 Nov 2024 11:39:20 +0700 Subject: [PATCH] feat: update articles old id --- app/database/entity/articles.entity.go | 1 + app/module/articles/request/articles.request.go | 2 ++ docs/swagger/docs.go | 3 +++ docs/swagger/swagger.json | 3 +++ docs/swagger/swagger.yaml | 2 ++ 5 files changed, 11 insertions(+) diff --git a/app/database/entity/articles.entity.go b/app/database/entity/articles.entity.go index f7df296..bdc9ba9 100644 --- a/app/database/entity/articles.entity.go +++ b/app/database/entity/articles.entity.go @@ -19,6 +19,7 @@ type Articles struct { ViewCount *int `json:"view_count" gorm:"type:int4"` DownloadCount *int `json:"download_count" gorm:"type:int4"` StatusId *int `json:"status_id" gorm:"type:int4"` + OldId *uint `json:"old_id" gorm:"type:int4"` IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"` PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"` IsActive *bool `json:"is_active" gorm:"type:bool;default:true"` diff --git a/app/module/articles/request/articles.request.go b/app/module/articles/request/articles.request.go index 7660392..60b2fa5 100644 --- a/app/module/articles/request/articles.request.go +++ b/app/module/articles/request/articles.request.go @@ -31,6 +31,7 @@ type ArticlesCreateRequest struct { CategoryId int `json:"categoryId" validate:"required"` TypeId int `json:"typeId" validate:"required"` Tags string `json:"tags" validate:"required"` + OldId *uint `json:"oldId"` } func (req ArticlesCreateRequest) ToEntity() *entity.Articles { @@ -42,6 +43,7 @@ func (req ArticlesCreateRequest) ToEntity() *entity.Articles { TypeId: req.TypeId, Tags: req.Tags, CategoryId: req.CategoryId, + OldId: req.OldId, } } diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 2ad289c..61ba81d 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -5373,6 +5373,9 @@ const docTemplate = `{ "htmlDescription": { "type": "string" }, + "oldId": { + "type": "integer" + }, "slug": { "type": "string" }, diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index e2c7448..00ac817 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -5362,6 +5362,9 @@ "htmlDescription": { "type": "string" }, + "oldId": { + "type": "integer" + }, "slug": { "type": "string" }, diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 3867aa1..e205112 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -98,6 +98,8 @@ definitions: type: string htmlDescription: type: string + oldId: + type: integer slug: type: string tags: