feat: add article approval

This commit is contained in:
hanif salafi 2025-02-17 21:02:17 +07:00
parent 6b8ab00e3b
commit f24cf7dcc4
9 changed files with 1063 additions and 26 deletions

View File

@ -21,6 +21,8 @@ type Articles struct {
ViewCount *int `json:"view_count" gorm:"type:int4;default:0"`
StatusId *int `json:"status_id" gorm:"type:int4"`
OldId *uint `json:"old_id" gorm:"type:int4"`
NeedApprovalFrom *int `json:"need_approval_from" gorm:"type:int4"`
HasApprovedBy *string `json:"has_approved_by" gorm:"type:varchar"`
IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"`
PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"`
IsDraft *bool `json:"is_draft" gorm:"type:bool;default:false"`

View File

@ -87,6 +87,7 @@ func Models() []interface{} {
entity.ActivityLogTypes{},
entity.Articles{},
entity.ArticleCategories{},
entity.ArticleApprovals{},
article_category_details.ArticleCategoryDetails{},
entity.ArticleFiles{},
entity.ArticleComments{},

View File

@ -127,7 +127,7 @@ func (_i *articlesRepository) Create(articles *entity.Articles) (articleReturn *
func (_i *articlesRepository) Update(id uint, articles *entity.Articles) (err error) {
return _i.DB.DB.Model(&entity.Articles{}).
Where(&entity.Articles{ID: id}).
Updates(articles).Error
Save(articles).Error
}
func (_i *articlesRepository) Delete(id uint) error {

View File

@ -8,6 +8,7 @@ import (
"github.com/minio/minio-go/v7"
"github.com/rs/zerolog"
"go-humas-be/app/database/entity"
articleApprovalsRepository "go-humas-be/app/module/article_approvals/repository"
articleCategoriesRepository "go-humas-be/app/module/article_categories/repository"
articleCategoryDetailsRepository "go-humas-be/app/module/article_category_details/repository"
articleCategoryDetailsReq "go-humas-be/app/module/article_category_details/request"
@ -36,6 +37,7 @@ type articlesService struct {
Repo repository.ArticlesRepository
ArticleCategoriesRepo articleCategoriesRepository.ArticleCategoriesRepository
ArticleFilesRepo articleFilesRepository.ArticleFilesRepository
ArticleApprovalsRepo articleApprovalsRepository.ArticleApprovalsRepository
ArticleCategoryDetailsRepo articleCategoryDetailsRepository.ArticleCategoryDetailsRepository
Log zerolog.Logger
Cfg *config.Config
@ -52,6 +54,7 @@ type ArticlesService interface {
Update(id uint, req request.ArticlesUpdateRequest) (err error)
Delete(id uint) error
UpdateActivityCount(id uint, activityTypeId int) (err error)
UpdateApproval(id uint, statusId int, userLevelId int, userLevelNumber int, userParentLevelId int) (err error)
Viewer(c *fiber.Ctx) error
SummaryStats(authToken string) (summaryStats *response.ArticleSummaryStats, err error)
ArticlePerUserLevelStats(authToken string, startDate *string, endDate *string) (articlePerUserLevelStats []*response.ArticlePerUserLevelStats, err error)
@ -64,6 +67,7 @@ func NewArticlesService(
articleCategoriesRepo articleCategoriesRepository.ArticleCategoriesRepository,
articleCategoryDetailsRepo articleCategoryDetailsRepository.ArticleCategoryDetailsRepository,
articleFilesRepo articleFilesRepository.ArticleFilesRepository,
articleApprovalsRepo articleApprovalsRepository.ArticleApprovalsRepository,
log zerolog.Logger,
cfg *config.Config,
usersRepo usersRepository.UsersRepository,
@ -75,6 +79,7 @@ func NewArticlesService(
ArticleCategoriesRepo: articleCategoriesRepo,
ArticleCategoryDetailsRepo: articleCategoryDetailsRepo,
ArticleFilesRepo: articleFilesRepo,
ArticleApprovalsRepo: articleApprovalsRepo,
Log: log,
UsersRepo: usersRepo,
MinioStorage: minioStorage,
@ -126,15 +131,21 @@ func (_i *articlesService) Save(req request.ArticlesCreateRequest, authToken str
_i.Log.Info().Interface("data", req).Msg("")
newReq := req.ToEntity()
var userLevelNumber int
var userParentLevelId int
if req.CreatedById != nil {
createdBy, err := _i.UsersRepo.FindOne(*req.CreatedById)
if err != nil {
return nil, fmt.Errorf("User not found")
}
newReq.CreatedById = &createdBy.ID
userLevelNumber = createdBy.UserLevel.LevelNumber
userParentLevelId = *createdBy.UserLevel.ParentLevelId
} else {
createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken)
newReq.CreatedById = &createdBy.ID
userLevelNumber = createdBy.UserLevel.LevelNumber
userParentLevelId = *createdBy.UserLevel.ParentLevelId
}
isDraft := true
@ -166,11 +177,30 @@ func (_i *articlesService) Save(req request.ArticlesCreateRequest, authToken str
newReq.CreatedAt = parsedTime
}
// Approval
statusIdOne := 1
newReq.NeedApprovalFrom = &userParentLevelId
newReq.StatusId = &statusIdOne
saveArticleRes, err := _i.Repo.Create(newReq)
if err != nil {
return nil, err
}
// Approval
articleApproval := &entity.ArticleApprovals{
ArticleId: saveArticleRes.ID,
ApprovalBy: *newReq.CreatedById,
StatusId: statusIdOne,
Message: "Need Approval",
ApprovalAtLevel: userLevelNumber,
}
_, err = _i.ArticleApprovalsRepo.Create(articleApproval)
if err != nil {
return nil, err
}
var categoryIds []string
if req.CategoryIds != "" {
categoryIds = strings.Split(req.CategoryIds, ",")
@ -452,6 +482,59 @@ func (_i *articlesService) ArticleMonthlyStats(authToken string, year *int) (art
return result, nil
}
func (_i *articlesService) UpdateApproval(id uint, statusId int, userLevelId int, userLevelNumber int, userParentLevelId int) (err error) {
result, err := _i.Repo.FindOne(id)
if err != nil {
return err
}
_i.Log.Info().Interface("statusId", statusId).Msg("")
statusIdOne := 1
statusIdTwo := 2
statusIdThree := 3
isPublish := true
isDraftFalse := false
if statusId == 2 {
if userLevelNumber == 2 || userLevelNumber == 3 {
result.NeedApprovalFrom = &userParentLevelId
result.StatusId = &statusIdOne
} else {
result.NeedApprovalFrom = nil
result.StatusId = &statusIdTwo
result.IsPublish = &isPublish
publishedAt := time.Now()
result.PublishedAt = &publishedAt
result.IsDraft = &isDraftFalse
result.DraftedAt = nil
}
userLevelIdStr := strconv.Itoa(userLevelId)
if result.HasApprovedBy == nil {
result.HasApprovedBy = &userLevelIdStr
} else {
hasApprovedBySlice := strings.Split(*result.HasApprovedBy, ",")
hasApprovedBySlice = append(hasApprovedBySlice, userLevelIdStr)
hasApprovedByJoin := strings.Join(hasApprovedBySlice, ",")
result.HasApprovedBy = &hasApprovedByJoin
}
} else if statusId == 3 {
result.StatusId = &statusIdThree
result.NeedApprovalFrom = nil
result.HasApprovedBy = nil
}
err = _i.Repo.Update(id, result)
if err != nil {
return err
}
return
}
func getFileExtension(filename string) string {
// split file name
parts := strings.Split(filename, ".")

View File

@ -4,6 +4,7 @@ import (
swagger "github.com/arsmn/fiber-swagger/v2"
"github.com/gofiber/fiber/v2"
"go-humas-be/app/module/activity_logs"
"go-humas-be/app/module/article_approvals"
"go-humas-be/app/module/article_categories"
"go-humas-be/app/module/article_category_details"
"go-humas-be/app/module/article_comments"
@ -35,6 +36,7 @@ type Router struct {
ArticleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter
ArticleFilesRouter *article_files.ArticleFilesRouter
ArticleCommentsRouter *article_comments.ArticleCommentsRouter
ArticleApprovalsRouter *article_approvals.ArticleApprovalsRouter
ArticlesRouter *articles.ArticlesRouter
ArticleNulisAIRouter *article_nulis_ai.ArticleNulisAIRouter
CitiesRouter *cities.CitiesRouter
@ -60,6 +62,7 @@ func NewRouter(
articleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter,
articleFilesRouter *article_files.ArticleFilesRouter,
articleCommentsRouter *article_comments.ArticleCommentsRouter,
articleApprovalsRouter *article_approvals.ArticleApprovalsRouter,
articlesRouter *articles.ArticlesRouter,
articleNulisRouter *article_nulis_ai.ArticleNulisAIRouter,
citiesRouter *cities.CitiesRouter,
@ -83,6 +86,7 @@ func NewRouter(
ArticleCategoryDetailsRouter: articleCategoryDetailsRouter,
ArticleFilesRouter: articleFilesRouter,
ArticleCommentsRouter: articleCommentsRouter,
ArticleApprovalsRouter: articleApprovalsRouter,
ArticlesRouter: articlesRouter,
ArticleNulisAIRouter: articleNulisRouter,
CitiesRouter: citiesRouter,
@ -115,6 +119,7 @@ func (r *Router) Register() {
r.ArticleCategoriesRouter.RegisterArticleCategoriesRoutes()
r.ArticleCategoryDetailsRouter.RegisterArticleCategoryDetailsRoutes()
r.ArticleFilesRouter.RegisterArticleFilesRoutes()
r.ArticleApprovalsRouter.RegisterArticleApprovalsRoutes()
r.ArticlesRouter.RegisterArticlesRoutes()
r.ArticleCommentsRouter.RegisterArticleCommentsRoutes()
r.ArticleNulisAIRouter.RegisterArticleNulisAIRoutes()

View File

@ -325,6 +325,322 @@ const docTemplate = `{
}
}
},
"/article-approvals": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting all ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "Get all ArticleApprovals",
"parameters": [
{
"type": "integer",
"name": "approvalAtLevel",
"in": "query"
},
{
"type": "integer",
"name": "approvalBy",
"in": "query"
},
{
"type": "integer",
"name": "articleId",
"in": "query"
},
{
"type": "string",
"name": "message",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"in": "query"
},
{
"type": "integer",
"name": "count",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "nextPage",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "previousPage",
"in": "query"
},
{
"type": "string",
"name": "sort",
"in": "query"
},
{
"type": "string",
"name": "sortBy",
"in": "query"
},
{
"type": "integer",
"name": "totalPage",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"description": "API for create ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "Create ArticleApprovals",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cAdd access token here\u003e",
"description": "Insert your access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.ArticleApprovalsCreateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
}
},
"/article-approvals/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting one ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "Get one ArticleApprovals",
"parameters": [
{
"type": "integer",
"description": "ArticleApprovals ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
},
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for update ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "update ArticleApprovals",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.ArticleApprovalsUpdateRequest"
}
},
{
"type": "integer",
"description": "ArticleApprovals ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"description": "API for delete ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "delete ArticleApprovals",
"parameters": [
{
"type": "integer",
"description": "ArticleApprovals ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
}
},
"/article-categories": {
"get": {
"security": [
@ -7572,6 +7888,48 @@ const docTemplate = `{
}
}
},
"request.ArticleApprovalsCreateRequest": {
"type": "object",
"required": [
"articleId",
"message",
"statusId"
],
"properties": {
"articleId": {
"type": "integer"
},
"message": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.ArticleApprovalsUpdateRequest": {
"type": "object",
"required": [
"articleId",
"id",
"message",
"statusId"
],
"properties": {
"articleId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"message": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.ArticleCategoriesCreateRequest": {
"type": "object",
"required": [

View File

@ -314,6 +314,322 @@
}
}
},
"/article-approvals": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting all ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "Get all ArticleApprovals",
"parameters": [
{
"type": "integer",
"name": "approvalAtLevel",
"in": "query"
},
{
"type": "integer",
"name": "approvalBy",
"in": "query"
},
{
"type": "integer",
"name": "articleId",
"in": "query"
},
{
"type": "string",
"name": "message",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"in": "query"
},
{
"type": "integer",
"name": "count",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "nextPage",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "previousPage",
"in": "query"
},
{
"type": "string",
"name": "sort",
"in": "query"
},
{
"type": "string",
"name": "sortBy",
"in": "query"
},
{
"type": "integer",
"name": "totalPage",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"description": "API for create ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "Create ArticleApprovals",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cAdd access token here\u003e",
"description": "Insert your access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.ArticleApprovalsCreateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
}
},
"/article-approvals/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting one ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "Get one ArticleApprovals",
"parameters": [
{
"type": "integer",
"description": "ArticleApprovals ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
},
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for update ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "update ArticleApprovals",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.ArticleApprovalsUpdateRequest"
}
},
{
"type": "integer",
"description": "ArticleApprovals ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"description": "API for delete ArticleApprovals",
"tags": [
"ArticleApprovals"
],
"summary": "delete ArticleApprovals",
"parameters": [
{
"type": "integer",
"description": "ArticleApprovals ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.UnauthorizedError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.InternalServerError"
}
}
}
}
},
"/article-categories": {
"get": {
"security": [
@ -7561,6 +7877,48 @@
}
}
},
"request.ArticleApprovalsCreateRequest": {
"type": "object",
"required": [
"articleId",
"message",
"statusId"
],
"properties": {
"articleId": {
"type": "integer"
},
"message": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.ArticleApprovalsUpdateRequest": {
"type": "object",
"required": [
"articleId",
"id",
"message",
"statusId"
],
"properties": {
"articleId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"message": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.ArticleCategoriesCreateRequest": {
"type": "object",
"required": [

View File

@ -49,6 +49,35 @@ definitions:
- id
- url
type: object
request.ArticleApprovalsCreateRequest:
properties:
articleId:
type: integer
message:
type: string
statusId:
type: integer
required:
- articleId
- message
- statusId
type: object
request.ArticleApprovalsUpdateRequest:
properties:
articleId:
type: integer
id:
type: integer
message:
type: string
statusId:
type: integer
required:
- articleId
- id
- message
- statusId
type: object
request.ArticleCategoriesCreateRequest:
properties:
description:
@ -989,6 +1018,205 @@ paths:
summary: update ActivityLogs
tags:
- ActivityLogs
/article-approvals:
get:
description: API for getting all ArticleApprovals
parameters:
- in: query
name: approvalAtLevel
type: integer
- in: query
name: approvalBy
type: integer
- in: query
name: articleId
type: integer
- in: query
name: message
type: string
- in: query
name: statusId
type: integer
- in: query
name: count
type: integer
- in: query
name: limit
type: integer
- in: query
name: nextPage
type: integer
- in: query
name: page
type: integer
- in: query
name: previousPage
type: integer
- in: query
name: sort
type: string
- in: query
name: sortBy
type: string
- in: query
name: totalPage
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.UnauthorizedError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.InternalServerError'
security:
- Bearer: []
summary: Get all ArticleApprovals
tags:
- ArticleApprovals
post:
description: API for create ArticleApprovals
parameters:
- default: Bearer <Add access token here>
description: Insert your access token
in: header
name: Authorization
required: true
type: string
- description: Required payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/request.ArticleApprovalsCreateRequest'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.UnauthorizedError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.InternalServerError'
security:
- Bearer: []
summary: Create ArticleApprovals
tags:
- ArticleApprovals
/article-approvals/{id}:
delete:
description: API for delete ArticleApprovals
parameters:
- description: ArticleApprovals ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.UnauthorizedError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.InternalServerError'
security:
- Bearer: []
summary: delete ArticleApprovals
tags:
- ArticleApprovals
get:
description: API for getting one ArticleApprovals
parameters:
- description: ArticleApprovals ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.UnauthorizedError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.InternalServerError'
security:
- Bearer: []
summary: Get one ArticleApprovals
tags:
- ArticleApprovals
put:
description: API for update ArticleApprovals
parameters:
- description: Required payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/request.ArticleApprovalsUpdateRequest'
- description: ArticleApprovals ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.UnauthorizedError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.InternalServerError'
security:
- Bearer: []
summary: update ArticleApprovals
tags:
- ArticleApprovals
/article-categories:
get:
description: API for getting all ArticleCategories

View File

@ -5,6 +5,7 @@ import (
"go-humas-be/app/database"
"go-humas-be/app/middleware"
"go-humas-be/app/module/activity_logs"
"go-humas-be/app/module/article_approvals"
"go-humas-be/app/module/article_categories"
"go-humas-be/app/module/article_category_details"
"go-humas-be/app/module/article_comments"
@ -59,6 +60,7 @@ func main() {
article_categories.NewArticleCategoriesModule,
article_category_details.NewArticleCategoryDetailsModule,
article_files.NewArticleFilesModule,
article_approvals.NewArticleApprovalsModule,
articles.NewArticlesModule,
article_comments.NewArticleCommentsModule,
article_nulis_ai.NewArticleNulisAIModule,