feat: update bug fixing articles

This commit is contained in:
hanif salafi 2025-07-03 13:28:32 +07:00
parent 906626931d
commit 9455bdb932
5 changed files with 26 additions and 8 deletions

View File

@ -162,7 +162,8 @@ func (_i *articlesController) ShowByOldId(c *fiber.Ctx) error {
// @Description API for create Articles // @Description API for create Articles
// @Tags Articles // @Tags Articles
// @Security Bearer // @Security Bearer
// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param X-Client-Key header string false "Insert the X-Client-Key"
// @Param X-Csrf-Token header string false "Insert the X-Csrf-Token"
// @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) // @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>)
// @Param payload body request.ArticlesCreateRequest true "Required payload" // @Param payload body request.ArticlesCreateRequest true "Required payload"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response

View File

@ -156,12 +156,16 @@ func (_i *articlesService) Save(clientId *uuid.UUID, req request.ArticlesCreateR
} }
newReq.CreatedById = &createdBy.ID newReq.CreatedById = &createdBy.ID
userLevelNumber = createdBy.UserLevel.LevelNumber userLevelNumber = createdBy.UserLevel.LevelNumber
userParentLevelId = *createdBy.UserLevel.ParentLevelId if createdBy.UserLevel.ParentLevelId != nil {
userParentLevelId = *createdBy.UserLevel.ParentLevelId
}
} else { } else {
createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken)
newReq.CreatedById = &createdBy.ID newReq.CreatedById = &createdBy.ID
userLevelNumber = createdBy.UserLevel.LevelNumber userLevelNumber = createdBy.UserLevel.LevelNumber
userParentLevelId = *createdBy.UserLevel.ParentLevelId if createdBy.UserLevel.ParentLevelId != nil {
userParentLevelId = *createdBy.UserLevel.ParentLevelId
}
} }
isDraft := true isDraft := true

View File

@ -3479,12 +3479,17 @@ const docTemplate = `{
], ],
"summary": "Create Articles", "summary": "Create Articles",
"parameters": [ "parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header"
},
{ {
"type": "string", "type": "string",
"description": "Insert the X-Csrf-Token", "description": "Insert the X-Csrf-Token",
"name": "X-Csrf-Token", "name": "X-Csrf-Token",
"in": "header", "in": "header"
"required": true
}, },
{ {
"type": "string", "type": "string",

View File

@ -3468,12 +3468,17 @@
], ],
"summary": "Create Articles", "summary": "Create Articles",
"parameters": [ "parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header"
},
{ {
"type": "string", "type": "string",
"description": "Insert the X-Csrf-Token", "description": "Insert the X-Csrf-Token",
"name": "X-Csrf-Token", "name": "X-Csrf-Token",
"in": "header", "in": "header"
"required": true
}, },
{ {
"type": "string", "type": "string",

View File

@ -3163,10 +3163,13 @@ paths:
post: post:
description: API for create Articles description: API for create Articles
parameters: parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
type: string
- description: Insert the X-Csrf-Token - description: Insert the X-Csrf-Token
in: header in: header
name: X-Csrf-Token name: X-Csrf-Token
required: true
type: string type: string
- default: Bearer <Add access token here> - default: Bearer <Add access token here>
description: Insert your access token description: Insert your access token