feat: update articles and swagger
This commit is contained in:
parent
17b32d68f4
commit
9fd0caa93a
|
|
@ -3,24 +3,24 @@ package entity
|
|||
import "time"
|
||||
|
||||
type Articles struct {
|
||||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||
Title string `json:"title" gorm:"type:varchar"`
|
||||
Slug string `json:"slug" gorm:"type:varchar"`
|
||||
Description string `json:"description" gorm:"type:varchar"`
|
||||
HtmlDescription string `json:"html_description" gorm:"type:varchar"`
|
||||
TypeId int `json:"type_id" gorm:"type:int4"`
|
||||
Tags string `json:"tags" 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 int `json:"created_by_id" gorm:"type:int4"`
|
||||
ShareCount int `json:"share_count" gorm:"type:int4"`
|
||||
ViewCount int `json:"view_count" gorm:"type:int4"`
|
||||
DownloadCount int `json:"download_count" 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"`
|
||||
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()"`
|
||||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||
Title string `json:"title" gorm:"type:varchar"`
|
||||
Slug string `json:"slug" gorm:"type:varchar"`
|
||||
Description string `json:"description" gorm:"type:varchar"`
|
||||
HtmlDescription string `json:"html_description" gorm:"type:varchar"`
|
||||
TypeId int `json:"type_id" gorm:"type:int4"`
|
||||
Tags string `json:"tags" 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 *int `json:"created_by_id" gorm:"type:int4"`
|
||||
ShareCount *int `json:"share_count" gorm:"type:int4"`
|
||||
ViewCount *int `json:"view_count" gorm:"type:int4"`
|
||||
DownloadCount *int `json:"download_count" 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"`
|
||||
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()"`
|
||||
}
|
||||
|
|
@ -29,11 +29,12 @@ func NewArticlesController(articlesService service.ArticlesService) ArticlesCont
|
|||
}
|
||||
}
|
||||
|
||||
// All get all Articles
|
||||
// All Articles
|
||||
// @Summary Get all Articles
|
||||
// @Description API for getting all Articles
|
||||
// @Tags Task
|
||||
// @Tags Articles
|
||||
// @Security Bearer
|
||||
// @Param req query request.ArticlesQueryRequest false "query parameters"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 401 {object} response.Response
|
||||
// @Failure 404 {object} response.Response
|
||||
|
|
@ -55,16 +56,17 @@ func (_i *articlesController) All(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Articles list successfully retrieved"},
|
||||
Data: articlesData,
|
||||
Meta: paging,
|
||||
})
|
||||
}
|
||||
|
||||
// Show get one Articles
|
||||
// Show Articles
|
||||
// @Summary Get one Articles
|
||||
// @Description API for getting one Articles
|
||||
// @Tags Task
|
||||
// @Tags Articles
|
||||
// @Security Bearer
|
||||
// @Param id path int true "Articles ID"
|
||||
// @Success 200 {object} response.Response
|
||||
|
|
@ -85,17 +87,18 @@ func (_i *articlesController) Show(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Articles successfully retrieved"},
|
||||
Data: articlesData,
|
||||
})
|
||||
}
|
||||
|
||||
// Save create Articles
|
||||
// Save Articles
|
||||
// @Summary Create Articles
|
||||
// @Description API for create Articles
|
||||
// @Tags Task
|
||||
// @Tags Articles
|
||||
// @Security Bearer
|
||||
// @Body request.ArticlesCreateRequest
|
||||
// @Param payload body request.ArticlesCreateRequest true "Required payload"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 401 {object} response.Response
|
||||
// @Failure 404 {object} response.Response
|
||||
|
|
@ -114,16 +117,17 @@ func (_i *articlesController) Save(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Articles successfully created"},
|
||||
})
|
||||
}
|
||||
|
||||
// Update update Articles
|
||||
// Update Articles
|
||||
// @Summary update Articles
|
||||
// @Description API for update Articles
|
||||
// @Tags Task
|
||||
// @Tags Articles
|
||||
// @Security Bearer
|
||||
// @Body request.ArticlesUpdateRequest
|
||||
// @Param payload body request.ArticlesUpdateRequest true "Required payload"
|
||||
// @Param id path int true "Articles ID"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 401 {object} response.Response
|
||||
|
|
@ -148,14 +152,15 @@ func (_i *articlesController) Update(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Articles successfully updated"},
|
||||
})
|
||||
}
|
||||
|
||||
// Delete delete Articles
|
||||
// Delete Articles
|
||||
// @Summary delete Articles
|
||||
// @Description API for delete Articles
|
||||
// @Tags Task
|
||||
// @Tags Articles
|
||||
// @Security Bearer
|
||||
// @Param id path int true "Articles ID"
|
||||
// @Success 200 {object} response.Response
|
||||
|
|
@ -176,6 +181,7 @@ func (_i *articlesController) Delete(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Articles successfully deleted"},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"go-humas-be/app/database"
|
||||
"go-humas-be/app/database/entity"
|
||||
"go-humas-be/app/module/articles/request"
|
||||
"go-humas-be/utils/paginator"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type articlesRepository struct {
|
||||
DB *database.Database
|
||||
DB *database.Database
|
||||
Log zerolog.Logger
|
||||
}
|
||||
|
||||
// ArticlesRepository define interface of IArticlesRepository
|
||||
|
|
@ -20,9 +23,10 @@ type ArticlesRepository interface {
|
|||
Delete(id uint) (err error)
|
||||
}
|
||||
|
||||
func NewArticlesRepository(db *database.Database) ArticlesRepository {
|
||||
func NewArticlesRepository(db *database.Database, log zerolog.Logger) ArticlesRepository {
|
||||
return &articlesRepository{
|
||||
DB: db,
|
||||
DB: db,
|
||||
Log: log,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +35,32 @@ func (_i *articlesRepository) GetAll(req request.ArticlesQueryRequest) (articles
|
|||
var count int64
|
||||
|
||||
query := _i.DB.DB.Model(&entity.Articles{})
|
||||
query = query.Where("is_active = ?", true)
|
||||
|
||||
if req.Title != nil && *req.Title != "" {
|
||||
title := strings.ToLower(*req.Title)
|
||||
query = query.Where("LOWER(title) LIKE ?", "%"+strings.ToLower(title)+"%")
|
||||
}
|
||||
if req.Description != nil && *req.Description != "" {
|
||||
description := strings.ToLower(*req.Description)
|
||||
query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%")
|
||||
}
|
||||
if req.TypeId != nil {
|
||||
query = query.Where("type_id = ?", req.TypeId)
|
||||
}
|
||||
if req.Tags != nil && *req.Tags != "" {
|
||||
tags := strings.ToLower(*req.Tags)
|
||||
query = query.Where("LOWER(tags) LIKE ?", "%"+strings.ToLower(tags)+"%")
|
||||
}
|
||||
if req.TypeId != nil {
|
||||
query = query.Where("type_id = ?", req.TypeId)
|
||||
}
|
||||
if req.IsPublish != nil {
|
||||
query = query.Where("is_publish = ?", req.IsPublish)
|
||||
}
|
||||
if req.StatusId != nil {
|
||||
query = query.Where("status_id = ?", req.StatusId)
|
||||
}
|
||||
query.Count(&count)
|
||||
|
||||
req.Pagination.Count = count
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package request
|
|||
import (
|
||||
"go-humas-be/app/database/entity"
|
||||
"go-humas-be/utils/paginator"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -11,44 +12,30 @@ type ArticlesGeneric interface {
|
|||
}
|
||||
|
||||
type ArticlesQueryRequest struct {
|
||||
Title string `json:"title" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"html_description" validate:"required"`
|
||||
TypeId int `json:"type_id" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
ThumbnailPath string `json:"thumbnail_path" validate:"required"`
|
||||
ThumbnailUrl string `json:"thumbnail_url" validate:"required"`
|
||||
PageUrl string `json:"page_url" validate:"required"`
|
||||
CreatedById int `json:"created_by_id" validate:"required"`
|
||||
ShareCount int `json:"share_count" validate:"required"`
|
||||
ViewCount int `json:"view_count" validate:"required"`
|
||||
DownloadCount int `json:"download_count" validate:"required"`
|
||||
StatusId int `json:"status_id" validate:"required"`
|
||||
IsPublish bool `json:"is_publish" validate:"required"`
|
||||
PublishedAt time.Time `json:"published_at" validate:"required"`
|
||||
IsActive bool `json:"is_active" validate:"required"`
|
||||
Pagination *paginator.Pagination `json:"pagination"`
|
||||
Title *string `json:"title"`
|
||||
Description *string `json:"description"`
|
||||
TypeId *int `json:"typeId"`
|
||||
Tags *string `json:"tags"`
|
||||
StatusId *int `json:"statusId"`
|
||||
IsPublish *bool `json:"isPublish"`
|
||||
Pagination *paginator.Pagination `json:"pagination"`
|
||||
}
|
||||
|
||||
type ArticlesCreateRequest struct {
|
||||
Title string `json:"title" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"html_description" validate:"required"`
|
||||
TypeId int `json:"type_id" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
ThumbnailPath string `json:"thumbnail_path" validate:"required"`
|
||||
ThumbnailUrl string `json:"thumbnail_url" validate:"required"`
|
||||
PageUrl string `json:"page_url" validate:"required"`
|
||||
CreatedById int `json:"created_by_id" validate:"required"`
|
||||
ShareCount int `json:"share_count" validate:"required"`
|
||||
ViewCount int `json:"view_count" validate:"required"`
|
||||
DownloadCount int `json:"download_count" validate:"required"`
|
||||
StatusId int `json:"status_id" validate:"required"`
|
||||
IsPublish bool `json:"is_publish" validate:"required"`
|
||||
PublishedAt time.Time `json:"published_at" validate:"required"`
|
||||
IsActive bool `json:"is_active" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"htmlDescription" validate:"required"`
|
||||
TypeId int `json:"typeId" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
ThumbnailPath *string `json:"thumbnailPath"`
|
||||
ThumbnailUrl *string `json:"thumbnailUrl"`
|
||||
PageUrl *string `json:"pageUrl"`
|
||||
CreatedById *int `json:"createdById"`
|
||||
StatusId *int `json:"status_id"`
|
||||
IsPublish *bool `json:"is_publish"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
}
|
||||
|
||||
func (req ArticlesCreateRequest) ToEntity() *entity.Articles {
|
||||
|
|
@ -63,9 +50,6 @@ func (req ArticlesCreateRequest) ToEntity() *entity.Articles {
|
|||
ThumbnailUrl: req.ThumbnailUrl,
|
||||
PageUrl: req.PageUrl,
|
||||
CreatedById: req.CreatedById,
|
||||
ShareCount: req.ShareCount,
|
||||
ViewCount: req.ViewCount,
|
||||
DownloadCount: req.DownloadCount,
|
||||
StatusId: req.StatusId,
|
||||
IsPublish: req.IsPublish,
|
||||
PublishedAt: req.PublishedAt,
|
||||
|
|
@ -74,49 +58,67 @@ func (req ArticlesCreateRequest) ToEntity() *entity.Articles {
|
|||
}
|
||||
|
||||
type ArticlesUpdateRequest struct {
|
||||
ID uint `json:"id" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"html_description" validate:"required"`
|
||||
TypeId int `json:"type_id" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
ThumbnailPath string `json:"thumbnail_path" validate:"required"`
|
||||
ThumbnailUrl string `json:"thumbnail_url" validate:"required"`
|
||||
PageUrl string `json:"page_url" validate:"required"`
|
||||
CreatedById int `json:"created_by_id" validate:"required"`
|
||||
ShareCount int `json:"share_count" validate:"required"`
|
||||
ViewCount int `json:"view_count" validate:"required"`
|
||||
DownloadCount int `json:"download_count" validate:"required"`
|
||||
StatusId int `json:"status_id" validate:"required"`
|
||||
IsPublish bool `json:"is_publish" validate:"required"`
|
||||
PublishedAt time.Time `json:"published_at" validate:"required"`
|
||||
IsActive bool `json:"is_active" validate:"required"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"htmlDescription" validate:"required"`
|
||||
TypeId int `json:"typeId" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
StatusId *int `json:"statusId"`
|
||||
}
|
||||
|
||||
func (req ArticlesUpdateRequest) ToEntity() *entity.Articles {
|
||||
return &entity.Articles{
|
||||
ID: req.ID,
|
||||
Title: req.Title,
|
||||
Slug: req.Slug,
|
||||
Description: req.Description,
|
||||
HtmlDescription: req.HtmlDescription,
|
||||
TypeId: req.TypeId,
|
||||
Tags: req.Tags,
|
||||
ThumbnailPath: req.ThumbnailPath,
|
||||
ThumbnailUrl: req.ThumbnailUrl,
|
||||
PageUrl: req.PageUrl,
|
||||
CreatedById: req.CreatedById,
|
||||
ShareCount: req.ShareCount,
|
||||
ViewCount: req.ViewCount,
|
||||
DownloadCount: req.DownloadCount,
|
||||
StatusId: req.StatusId,
|
||||
IsPublish: req.IsPublish,
|
||||
PublishedAt: req.PublishedAt,
|
||||
IsActive: req.IsActive,
|
||||
CreatedAt: req.CreatedAt,
|
||||
UpdatedAt: req.UpdatedAt,
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
type ArticlesQueryRequestContext struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
TypeId string `json:"typeId"`
|
||||
Tags string `json:"tags"`
|
||||
IsPublish string `json:"isPublish"`
|
||||
StatusId string `json:"statusId"`
|
||||
}
|
||||
|
||||
func (req ArticlesQueryRequestContext) ToParamRequest() ArticlesQueryRequest {
|
||||
var request ArticlesQueryRequest
|
||||
|
||||
if title := req.Title; title != "" {
|
||||
request.Title = &title
|
||||
}
|
||||
if description := req.Description; description != "" {
|
||||
request.Description = &description
|
||||
}
|
||||
if typeIdStr := req.TypeId; typeIdStr != "" {
|
||||
typeId, err := strconv.Atoi(typeIdStr)
|
||||
if err == nil {
|
||||
request.TypeId = &typeId
|
||||
}
|
||||
}
|
||||
if tags := req.Tags; tags != "" {
|
||||
request.Tags = &tags
|
||||
}
|
||||
if isPublishStr := req.IsPublish; isPublishStr != "" {
|
||||
isPublish, err := strconv.ParseBool(isPublishStr)
|
||||
if err == nil {
|
||||
request.IsPublish = &isPublish
|
||||
}
|
||||
}
|
||||
if statusIdStr := req.StatusId; statusIdStr != "" {
|
||||
statusId, err := strconv.Atoi(statusIdStr)
|
||||
if err == nil {
|
||||
request.StatusId = &statusId
|
||||
}
|
||||
}
|
||||
|
||||
return request
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,24 +3,24 @@ package response
|
|||
import "time"
|
||||
|
||||
type ArticlesResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
HtmlDescription string `json:"html_description"`
|
||||
TypeId int `json:"type_id"`
|
||||
Tags string `json:"tags"`
|
||||
ThumbnailPath string `json:"thumbnail_path"`
|
||||
ThumbnailUrl string `json:"thumbnail_url"`
|
||||
PageUrl string `json:"page_url"`
|
||||
CreatedById int `json:"created_by_id"`
|
||||
ShareCount int `json:"share_count"`
|
||||
ViewCount int `json:"view_count"`
|
||||
DownloadCount int `json:"download_count"`
|
||||
StatusId int `json:"status_id"`
|
||||
IsPublish bool `json:"is_publish"`
|
||||
PublishedAt time.Time `json:"published_at"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
HtmlDescription string `json:"html_description"`
|
||||
TypeId int `json:"type_id"`
|
||||
Tags string `json:"tags"`
|
||||
ThumbnailPath *string `json:"thumbnail_path"`
|
||||
ThumbnailUrl *string `json:"thumbnail_url"`
|
||||
PageUrl *string `json:"page_url"`
|
||||
CreatedById *int `json:"created_by_id"`
|
||||
ShareCount *int `json:"share_count"`
|
||||
ViewCount *int `json:"view_count"`
|
||||
DownloadCount *int `json:"download_count"`
|
||||
StatusId *int `json:"status_id"`
|
||||
IsPublish *bool `json:"is_publish"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
|
@ -68,5 +68,12 @@ func (_i *articlesService) Update(id uint, req request.ArticlesUpdateRequest) (e
|
|||
}
|
||||
|
||||
func (_i *articlesService) Delete(id uint) error {
|
||||
return _i.Repo.Delete(id)
|
||||
result, err := _i.Repo.FindOne(id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
isActive := false
|
||||
result.IsActive = &isActive
|
||||
return _i.Repo.Update(id, result)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ func (_i *userLevelsController) Delete(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"UserLevels successfully deleted"},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ package response
|
|||
import "time"
|
||||
|
||||
type UserLevelsResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AliasName string `json:"alias_name"`
|
||||
LevelNumber int `json:"level_number"`
|
||||
ParentLevelId int `json:"parent_level_id"`
|
||||
ProvinceId int `json:"province_id"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AliasName string `json:"alias_name"`
|
||||
LevelNumber int `json:"level_number"`
|
||||
ParentLevelId int `json:"parent_level_id"`
|
||||
ProvinceId int `json:"province_id"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
|
@ -191,6 +191,7 @@ func (_i *usersController) Delete(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Users successfully deleted"},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -910,9 +910,41 @@ const docTemplate = `{
|
|||
],
|
||||
"description": "API for getting all Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "Get all Articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "description",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"name": "isPublish",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "statusId",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "tags",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "title",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "typeId",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
|
@ -954,9 +986,20 @@ const docTemplate = `{
|
|||
],
|
||||
"description": "API for create Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "Create Articles",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.ArticlesCreateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
|
@ -1000,7 +1043,7 @@ const docTemplate = `{
|
|||
],
|
||||
"description": "API for getting one Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "Get one Articles",
|
||||
"parameters": [
|
||||
|
|
@ -1053,10 +1096,19 @@ const docTemplate = `{
|
|||
],
|
||||
"description": "API for update Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "update Articles",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.ArticlesUpdateRequest"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Articles ID",
|
||||
|
|
@ -1106,7 +1158,7 @@ const docTemplate = `{
|
|||
],
|
||||
"description": "API for delete Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "delete Articles",
|
||||
"parameters": [
|
||||
|
|
@ -5165,6 +5217,95 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.ArticlesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description",
|
||||
"htmlDescription",
|
||||
"slug",
|
||||
"tags",
|
||||
"title",
|
||||
"typeId"
|
||||
],
|
||||
"properties": {
|
||||
"createdById": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"htmlDescription": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"is_publish": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"pageUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"published_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"status_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tags": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"typeId": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.ArticlesUpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description",
|
||||
"htmlDescription",
|
||||
"slug",
|
||||
"tags",
|
||||
"title",
|
||||
"typeId"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"htmlDescription": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"statusId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tags": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"typeId": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CitiesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -899,9 +899,41 @@
|
|||
],
|
||||
"description": "API for getting all Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "Get all Articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "description",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"name": "isPublish",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "statusId",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "tags",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "title",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "typeId",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
|
@ -943,9 +975,20 @@
|
|||
],
|
||||
"description": "API for create Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "Create Articles",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.ArticlesCreateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
|
@ -989,7 +1032,7 @@
|
|||
],
|
||||
"description": "API for getting one Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "Get one Articles",
|
||||
"parameters": [
|
||||
|
|
@ -1042,10 +1085,19 @@
|
|||
],
|
||||
"description": "API for update Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "update Articles",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.ArticlesUpdateRequest"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Articles ID",
|
||||
|
|
@ -1095,7 +1147,7 @@
|
|||
],
|
||||
"description": "API for delete Articles",
|
||||
"tags": [
|
||||
"Task"
|
||||
"Articles"
|
||||
],
|
||||
"summary": "delete Articles",
|
||||
"parameters": [
|
||||
|
|
@ -5154,6 +5206,95 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.ArticlesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description",
|
||||
"htmlDescription",
|
||||
"slug",
|
||||
"tags",
|
||||
"title",
|
||||
"typeId"
|
||||
],
|
||||
"properties": {
|
||||
"createdById": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"htmlDescription": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"is_publish": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"pageUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"published_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"status_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tags": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"typeId": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.ArticlesUpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description",
|
||||
"htmlDescription",
|
||||
"slug",
|
||||
"tags",
|
||||
"title",
|
||||
"typeId"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"htmlDescription": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"statusId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tags": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"typeId": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CitiesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -51,6 +51,68 @@ definitions:
|
|||
- thumbnail_url
|
||||
- title
|
||||
type: object
|
||||
request.ArticlesCreateRequest:
|
||||
properties:
|
||||
createdById:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
htmlDescription:
|
||||
type: string
|
||||
is_active:
|
||||
type: boolean
|
||||
is_publish:
|
||||
type: boolean
|
||||
pageUrl:
|
||||
type: string
|
||||
published_at:
|
||||
type: string
|
||||
slug:
|
||||
type: string
|
||||
status_id:
|
||||
type: integer
|
||||
tags:
|
||||
type: string
|
||||
thumbnailPath:
|
||||
type: string
|
||||
thumbnailUrl:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
typeId:
|
||||
type: integer
|
||||
required:
|
||||
- description
|
||||
- htmlDescription
|
||||
- slug
|
||||
- tags
|
||||
- title
|
||||
- typeId
|
||||
type: object
|
||||
request.ArticlesUpdateRequest:
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
htmlDescription:
|
||||
type: string
|
||||
slug:
|
||||
type: string
|
||||
statusId:
|
||||
type: integer
|
||||
tags:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
typeId:
|
||||
type: integer
|
||||
required:
|
||||
- description
|
||||
- htmlDescription
|
||||
- slug
|
||||
- tags
|
||||
- title
|
||||
- typeId
|
||||
type: object
|
||||
request.CitiesCreateRequest:
|
||||
properties:
|
||||
city_name:
|
||||
|
|
@ -837,6 +899,25 @@ paths:
|
|||
/articles:
|
||||
get:
|
||||
description: API for getting all Articles
|
||||
parameters:
|
||||
- in: query
|
||||
name: description
|
||||
type: string
|
||||
- in: query
|
||||
name: isPublish
|
||||
type: boolean
|
||||
- in: query
|
||||
name: statusId
|
||||
type: integer
|
||||
- in: query
|
||||
name: tags
|
||||
type: string
|
||||
- in: query
|
||||
name: title
|
||||
type: string
|
||||
- in: query
|
||||
name: typeId
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
@ -862,9 +943,16 @@ paths:
|
|||
- Bearer: []
|
||||
summary: Get all Articles
|
||||
tags:
|
||||
- Task
|
||||
- Articles
|
||||
post:
|
||||
description: API for create Articles
|
||||
parameters:
|
||||
- description: Required payload
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.ArticlesCreateRequest'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
@ -890,7 +978,7 @@ paths:
|
|||
- Bearer: []
|
||||
summary: Create Articles
|
||||
tags:
|
||||
- Task
|
||||
- Articles
|
||||
/articles/{id}:
|
||||
delete:
|
||||
description: API for delete Articles
|
||||
|
|
@ -925,7 +1013,7 @@ paths:
|
|||
- Bearer: []
|
||||
summary: delete Articles
|
||||
tags:
|
||||
- Task
|
||||
- Articles
|
||||
get:
|
||||
description: API for getting one Articles
|
||||
parameters:
|
||||
|
|
@ -959,10 +1047,16 @@ paths:
|
|||
- Bearer: []
|
||||
summary: Get one Articles
|
||||
tags:
|
||||
- Task
|
||||
- Articles
|
||||
put:
|
||||
description: API for update Articles
|
||||
parameters:
|
||||
- description: Required payload
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.ArticlesUpdateRequest'
|
||||
- description: Articles ID
|
||||
in: path
|
||||
name: id
|
||||
|
|
@ -993,7 +1087,7 @@ paths:
|
|||
- Bearer: []
|
||||
summary: update Articles
|
||||
tags:
|
||||
- Task
|
||||
- Articles
|
||||
/cities:
|
||||
get:
|
||||
description: API for getting all Cities
|
||||
|
|
|
|||
Loading…
Reference in New Issue