feat: update magazine and swagger
This commit is contained in:
parent
6624f5260c
commit
8012896dfb
|
|
@ -6,13 +6,13 @@ type Magazines struct {
|
|||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||
Title string `json:"title" gorm:"type:varchar"`
|
||||
Description string `json:"description" gorm:"type:varchar"`
|
||||
ThumbnailPath string `json:"thumbnail_path" gorm:"type:varchar"`
|
||||
ThumbnailUrl string `json:"thumbnail_url" gorm:"type:varchar"`
|
||||
PageUrl string `json:"page_url" gorm:"type:varchar"`
|
||||
ThumbnailPath *string `json:"thumbnail_path" gorm:"type:varchar"`
|
||||
ThumbnailUrl *string `json:"thumbnail_url" gorm:"type:varchar"`
|
||||
PageUrl *string `json:"page_url" gorm:"type:varchar"`
|
||||
CreatedById *uint `json:"created_by_id" gorm:"type:int4"`
|
||||
StatusId int `json:"status_id" gorm:"type:int4"`
|
||||
IsPublish bool `json:"is_publish" gorm:"type:bool"`
|
||||
PublishedAt time.Time `json:"published_at" gorm:"type:timestamp"`
|
||||
IsPublish *bool `json:"is_publish" gorm:"type:bool"`
|
||||
PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"`
|
||||
IsActive bool `json:"is_active" gorm:"type:bool"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||||
|
|
|
|||
|
|
@ -26,14 +26,13 @@ type MagazinesQueryRequest struct {
|
|||
type MagazinesCreateRequest struct {
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
ThumbnailPath string `json:"thumbnailPath" validate:"required"`
|
||||
ThumbnailUrl string `json:"thumbnailUrl" validate:"required"`
|
||||
PageUrl string `json:"pageUrl" validate:"required"`
|
||||
CreatedById *uint `json:"createdById" validate:"required"`
|
||||
StatusId int `json:"statusId" validate:"required"`
|
||||
IsPublish bool `json:"isPublish" validate:"required"`
|
||||
PublishedAt time.Time `json:"publishedAt" validate:"required"`
|
||||
IsActive bool `json:"isActive" validate:"required"`
|
||||
ThumbnailPath *string `json:"thumbnailPath"`
|
||||
ThumbnailUrl *string `json:"thumbnailUrl"`
|
||||
PageUrl *string `json:"pageUrl"`
|
||||
CreatedById *uint `json:"createdById"`
|
||||
IsPublish *bool `json:"isPublish"`
|
||||
PublishedAt *time.Time `json:"publishedAt"`
|
||||
}
|
||||
|
||||
func (req MagazinesCreateRequest) ToEntity() *entity.Magazines {
|
||||
|
|
@ -47,7 +46,6 @@ func (req MagazinesCreateRequest) ToEntity() *entity.Magazines {
|
|||
StatusId: req.StatusId,
|
||||
IsPublish: req.IsPublish,
|
||||
PublishedAt: req.PublishedAt,
|
||||
IsActive: req.IsActive,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,16 +53,13 @@ type MagazinesUpdateRequest struct {
|
|||
ID uint `json:"id" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
ThumbnailPath string `json:"thumbnailPath" validate:"required"`
|
||||
ThumbnailUrl string `json:"thumbnailUrl" validate:"required"`
|
||||
PageUrl string `json:"pageUrl" validate:"required"`
|
||||
CreatedById *uint `json:"createdById" validate:"required"`
|
||||
StatusId int `json:"statusId" validate:"required"`
|
||||
IsPublish bool `json:"isPublish" validate:"required"`
|
||||
PublishedAt time.Time `json:"publishedAt" validate:"required"`
|
||||
IsActive bool `json:"isActive" validate:"required"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ThumbnailPath *string `json:"thumbnailPath"`
|
||||
ThumbnailUrl *string `json:"thumbnailUrl"`
|
||||
PageUrl *string `json:"pageUrl"`
|
||||
CreatedById *uint `json:"createdById"`
|
||||
IsPublish *bool `json:"isPublish"`
|
||||
PublishedAt *time.Time `json:"publishedAt"`
|
||||
}
|
||||
|
||||
func (req MagazinesUpdateRequest) ToEntity() *entity.Magazines {
|
||||
|
|
@ -79,9 +74,7 @@ func (req MagazinesUpdateRequest) ToEntity() *entity.Magazines {
|
|||
StatusId: req.StatusId,
|
||||
IsPublish: req.IsPublish,
|
||||
PublishedAt: req.PublishedAt,
|
||||
IsActive: req.IsActive,
|
||||
CreatedAt: req.CreatedAt,
|
||||
UpdatedAt: req.UpdatedAt,
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ type MagazinesResponse struct {
|
|||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
ThumbnailPath string `json:"thumbnailPath"`
|
||||
ThumbnailUrl string `json:"thumbnailUrl"`
|
||||
PageUrl string `json:"pageUrl"`
|
||||
ThumbnailPath *string `json:"thumbnailPath"`
|
||||
ThumbnailUrl *string `json:"thumbnailUrl"`
|
||||
PageUrl *string `json:"pageUrl"`
|
||||
CreatedById *uint `json:"createdById"`
|
||||
StatusId int `json:"statusId"`
|
||||
IsPublish bool `json:"isPublish"`
|
||||
PublishedAt time.Time `json:"publishedAt"`
|
||||
IsPublish *bool `json:"isPublish"`
|
||||
PublishedAt *time.Time `json:"publishedAt"`
|
||||
IsActive bool `json:"isActive"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
|
|
|
|||
|
|
@ -6465,15 +6465,8 @@ const docTemplate = `{
|
|||
"request.MagazinesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"createdById",
|
||||
"description",
|
||||
"isActive",
|
||||
"isPublish",
|
||||
"pageUrl",
|
||||
"publishedAt",
|
||||
"statusId",
|
||||
"thumbnailPath",
|
||||
"thumbnailUrl",
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
|
|
@ -6483,9 +6476,6 @@ const docTemplate = `{
|
|||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPublish": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
@ -6512,22 +6502,12 @@ const docTemplate = `{
|
|||
"request.MagazinesUpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"createdById",
|
||||
"description",
|
||||
"id",
|
||||
"isActive",
|
||||
"isPublish",
|
||||
"pageUrl",
|
||||
"publishedAt",
|
||||
"statusId",
|
||||
"thumbnailPath",
|
||||
"thumbnailUrl",
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdById": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
|
@ -6537,9 +6517,6 @@ const docTemplate = `{
|
|||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPublish": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
@ -6560,9 +6537,6 @@ const docTemplate = `{
|
|||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6454,15 +6454,8 @@
|
|||
"request.MagazinesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"createdById",
|
||||
"description",
|
||||
"isActive",
|
||||
"isPublish",
|
||||
"pageUrl",
|
||||
"publishedAt",
|
||||
"statusId",
|
||||
"thumbnailPath",
|
||||
"thumbnailUrl",
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
|
|
@ -6472,9 +6465,6 @@
|
|||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPublish": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
@ -6501,22 +6491,12 @@
|
|||
"request.MagazinesUpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"createdById",
|
||||
"description",
|
||||
"id",
|
||||
"isActive",
|
||||
"isPublish",
|
||||
"pageUrl",
|
||||
"publishedAt",
|
||||
"statusId",
|
||||
"thumbnailPath",
|
||||
"thumbnailUrl",
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdById": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
|
@ -6526,9 +6506,6 @@
|
|||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPublish": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
@ -6549,9 +6526,6 @@
|
|||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -271,8 +271,6 @@ definitions:
|
|||
type: integer
|
||||
description:
|
||||
type: string
|
||||
isActive:
|
||||
type: boolean
|
||||
isPublish:
|
||||
type: boolean
|
||||
pageUrl:
|
||||
|
|
@ -288,29 +286,18 @@ definitions:
|
|||
title:
|
||||
type: string
|
||||
required:
|
||||
- createdById
|
||||
- description
|
||||
- isActive
|
||||
- isPublish
|
||||
- pageUrl
|
||||
- publishedAt
|
||||
- statusId
|
||||
- thumbnailPath
|
||||
- thumbnailUrl
|
||||
- title
|
||||
type: object
|
||||
request.MagazinesUpdateRequest:
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
createdById:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
isActive:
|
||||
type: boolean
|
||||
isPublish:
|
||||
type: boolean
|
||||
pageUrl:
|
||||
|
|
@ -325,19 +312,10 @@ definitions:
|
|||
type: string
|
||||
title:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
required:
|
||||
- createdById
|
||||
- description
|
||||
- id
|
||||
- isActive
|
||||
- isPublish
|
||||
- pageUrl
|
||||
- publishedAt
|
||||
- statusId
|
||||
- thumbnailPath
|
||||
- thumbnailUrl
|
||||
- title
|
||||
type: object
|
||||
request.MasterMenusCreateRequest:
|
||||
|
|
|
|||
Loading…
Reference in New Issue