feat: update articles old id

This commit is contained in:
hanif salafi 2024-11-07 11:39:20 +07:00
parent 5e46b123a8
commit 9c0c485775
5 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,7 @@ type Articles struct {
ViewCount *int `json:"view_count" gorm:"type:int4"` ViewCount *int `json:"view_count" gorm:"type:int4"`
DownloadCount *int `json:"download_count" gorm:"type:int4"` DownloadCount *int `json:"download_count" gorm:"type:int4"`
StatusId *int `json:"status_id" 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"` IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"`
PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"` PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"`
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"` IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`

View File

@ -31,6 +31,7 @@ type ArticlesCreateRequest struct {
CategoryId int `json:"categoryId" validate:"required"` CategoryId int `json:"categoryId" validate:"required"`
TypeId int `json:"typeId" validate:"required"` TypeId int `json:"typeId" validate:"required"`
Tags string `json:"tags" validate:"required"` Tags string `json:"tags" validate:"required"`
OldId *uint `json:"oldId"`
} }
func (req ArticlesCreateRequest) ToEntity() *entity.Articles { func (req ArticlesCreateRequest) ToEntity() *entity.Articles {
@ -42,6 +43,7 @@ func (req ArticlesCreateRequest) ToEntity() *entity.Articles {
TypeId: req.TypeId, TypeId: req.TypeId,
Tags: req.Tags, Tags: req.Tags,
CategoryId: req.CategoryId, CategoryId: req.CategoryId,
OldId: req.OldId,
} }
} }

View File

@ -5373,6 +5373,9 @@ const docTemplate = `{
"htmlDescription": { "htmlDescription": {
"type": "string" "type": "string"
}, },
"oldId": {
"type": "integer"
},
"slug": { "slug": {
"type": "string" "type": "string"
}, },

View File

@ -5362,6 +5362,9 @@
"htmlDescription": { "htmlDescription": {
"type": "string" "type": "string"
}, },
"oldId": {
"type": "integer"
},
"slug": { "slug": {
"type": "string" "type": "string"
}, },

View File

@ -98,6 +98,8 @@ definitions:
type: string type: string
htmlDescription: htmlDescription:
type: string type: string
oldId:
type: integer
slug: slug:
type: string type: string
tags: tags: