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