feat: update save user for non login

This commit is contained in:
hanif salafi 2024-07-15 09:36:19 +07:00
parent 96fb556624
commit c4c520866b
5 changed files with 9 additions and 8 deletions

View File

@ -138,7 +138,7 @@ func (_i *usersController) ShowInfo(c *fiber.Ctx) error {
// @Description API for create Users
// @Tags Users
// @Security Bearer
// @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>)
// @Param Authorization header string false "Insert your access token" default(Bearer <Add access token here>)
// @Param payload body request.UsersCreateRequest true "Required payload"
// @Success 200 {object} response.Response
// @Failure 400 {object} response.BadRequestError

View File

@ -73,8 +73,12 @@ func (_i *usersService) Save(req request.UsersCreateRequest, authToken string) (
_i.Log.Info().Interface("data", req).Msg("")
newReq := req.ToEntity()
createdBy := utilSvc.GetUserInfo(_i.Log, _i.Repo, authToken)
newReq.CreatedById = &createdBy.ID
_i.Log.Info().Interface("AUTH TOKEN", authToken).Msg("")
if authToken != "" {
createdBy := utilSvc.GetUserInfo(_i.Log, _i.Repo, authToken)
newReq.CreatedById = &createdBy.ID
}
keycloakId, err := _i.Keycloak.CreateUser(req.Fullname, req.Email, req.Username, req.Password)
if err != nil {

View File

@ -8187,8 +8187,7 @@ const docTemplate = `{
"default": "Bearer \u003cAdd access token here\u003e",
"description": "Insert your access token",
"name": "Authorization",
"in": "header",
"required": true
"in": "header"
},
{
"description": "Required payload",

View File

@ -8176,8 +8176,7 @@
"default": "Bearer \u003cAdd access token here\u003e",
"description": "Insert your access token",
"name": "Authorization",
"in": "header",
"required": true
"in": "header"
},
{
"description": "Required payload",

View File

@ -6023,7 +6023,6 @@ paths:
description: Insert your access token
in: header
name: Authorization
required: true
type: string
- description: Required payload
in: body