feat: update users request createdbyid

This commit is contained in:
hanif salafi 2024-11-07 11:31:28 +07:00
parent 0df57b40a7
commit cf1003267c
4 changed files with 49 additions and 68 deletions

View File

@ -53,20 +53,36 @@ type ArticlesUpdateRequest struct {
CategoryId int `json:"categoryId" validate:"required"`
TypeId int `json:"typeId" validate:"required"`
Tags string `json:"tags" validate:"required"`
CreatedById *uint `json:"createdById"`
StatusId *int `json:"statusId"`
}
func (req ArticlesUpdateRequest) ToEntity() *entity.Articles {
return &entity.Articles{
Title: req.Title,
Slug: req.Slug,
Description: req.Description,
HtmlDescription: req.HtmlDescription,
CategoryId: req.CategoryId,
TypeId: req.TypeId,
Tags: req.Tags,
StatusId: req.StatusId,
UpdatedAt: time.Now(),
if req.CreatedById == nil {
return &entity.Articles{
Title: req.Title,
Slug: req.Slug,
Description: req.Description,
HtmlDescription: req.HtmlDescription,
CategoryId: req.CategoryId,
TypeId: req.TypeId,
Tags: req.Tags,
StatusId: req.StatusId,
UpdatedAt: time.Now(),
}
} else {
return &entity.Articles{
Title: req.Title,
Slug: req.Slug,
Description: req.Description,
HtmlDescription: req.HtmlDescription,
CategoryId: req.CategoryId,
TypeId: req.TypeId,
Tags: req.Tags,
StatusId: req.StatusId,
CreatedById: req.CreatedById,
UpdatedAt: time.Now(),
}
}
}

View File

@ -5402,6 +5402,9 @@ const docTemplate = `{
"categoryId": {
"type": "integer"
},
"createdById": {
"type": "integer"
},
"description": {
"type": "string"
},
@ -5765,22 +5768,13 @@ const docTemplate = `{
"request.UsersCreateRequest": {
"type": "object",
"required": [
"address",
"dateOfBirth",
"email",
"fullname",
"genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber",
"identityType",
"lastEducation",
"password",
"phoneNumber",
"userLevelId",
"userRoleId",
"username",
"workType"
"username"
],
"properties": {
"address": {
@ -5836,21 +5830,13 @@ const docTemplate = `{
"request.UsersUpdateRequest": {
"type": "object",
"required": [
"address",
"dateOfBirth",
"email",
"fullname",
"genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber",
"identityType",
"lastEducation",
"password",
"phoneNumber",
"userLevelId",
"userRoleId",
"username",
"workType"
"username"
],
"properties": {
"address": {
@ -5883,6 +5869,9 @@ const docTemplate = `{
"lastEducation": {
"type": "string"
},
"password": {
"type": "string"
},
"phoneNumber": {
"type": "string"
},

View File

@ -5391,6 +5391,9 @@
"categoryId": {
"type": "integer"
},
"createdById": {
"type": "integer"
},
"description": {
"type": "string"
},
@ -5754,22 +5757,13 @@
"request.UsersCreateRequest": {
"type": "object",
"required": [
"address",
"dateOfBirth",
"email",
"fullname",
"genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber",
"identityType",
"lastEducation",
"password",
"phoneNumber",
"userLevelId",
"userRoleId",
"username",
"workType"
"username"
],
"properties": {
"address": {
@ -5825,21 +5819,13 @@
"request.UsersUpdateRequest": {
"type": "object",
"required": [
"address",
"dateOfBirth",
"email",
"fullname",
"genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber",
"identityType",
"lastEducation",
"password",
"phoneNumber",
"userLevelId",
"userRoleId",
"username",
"workType"
"username"
],
"properties": {
"address": {
@ -5872,6 +5858,9 @@
"lastEducation": {
"type": "string"
},
"password": {
"type": "string"
},
"phoneNumber": {
"type": "string"
},

View File

@ -119,6 +119,8 @@ definitions:
properties:
categoryId:
type: integer
createdById:
type: integer
description:
type: string
htmlDescription:
@ -413,22 +415,13 @@ definitions:
workType:
type: string
required:
- address
- dateOfBirth
- email
- fullname
- genderType
- identityGroup
- identityGroupNumber
- identityNumber
- identityType
- lastEducation
- password
- phoneNumber
- userLevelId
- userRoleId
- username
- workType
type: object
request.UsersUpdateRequest:
properties:
@ -452,6 +445,8 @@ definitions:
type: string
lastEducation:
type: string
password:
type: string
phoneNumber:
type: string
statusId:
@ -465,21 +460,13 @@ definitions:
workType:
type: string
required:
- address
- dateOfBirth
- email
- fullname
- genderType
- identityGroup
- identityGroupNumber
- identityNumber
- identityType
- lastEducation
- password
- phoneNumber
- userLevelId
- userRoleId
- username
- workType
type: object
response.BadRequestError:
properties: