forked from ebhomengo/niki
1
0
Fork 0

fix(param): add json tag to fields

This commit is contained in:
Erfan Mohammadi 2024-05-22 01:40:16 +03:30
parent 53017a31a5
commit 5262356b5e
9 changed files with 122 additions and 139 deletions

View File

@ -796,7 +796,7 @@ const docTemplate = `{
"adminkindboxreqparam.KindBoxReqGetAllResponse": {
"type": "object",
"properties": {
"allKindBoxReq": {
"all_kind_box_req": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.KindBoxReq"
@ -865,31 +865,52 @@ const docTemplate = `{
"type": "object",
"properties": {
"description": {
"type": "string"
"type": "string",
"example": "This is a description"
},
"email": {
"type": "string"
"type": "string",
"example": "example@gmail.com"
},
"first_name": {
"type": "string"
"type": "string",
"example": "John"
},
"gender": {
"$ref": "#/definitions/entity.Gender"
"allOf": [
{
"$ref": "#/definitions/entity.Gender"
}
],
"example": 1
},
"id": {
"type": "integer"
"type": "integer",
"example": 1
},
"last_name": {
"type": "string"
"type": "string",
"example": "Doe"
},
"phone_number": {
"type": "string"
"type": "string",
"example": "09123456789"
},
"role": {
"$ref": "#/definitions/entity.AdminRole"
"allOf": [
{
"$ref": "#/definitions/entity.AdminRole"
}
],
"example": 2
},
"status": {
"$ref": "#/definitions/entity.AdminStatus"
"allOf": [
{
"$ref": "#/definitions/entity.AdminStatus"
}
],
"example": 1
}
}
},
@ -1157,38 +1178,8 @@ const docTemplate = `{
"benefactorkindboxreqparam.KindBoxReqGetResponse": {
"type": "object",
"properties": {
"benefactorID": {
"type": "integer"
},
"countAccepted": {
"type": "integer"
},
"countRequested": {
"type": "integer"
},
"deliverAddressID": {
"type": "integer"
},
"deliverReferDate": {
"type": "string"
},
"deliveredAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"kindBoxType": {
"$ref": "#/definitions/entity.KindBoxType"
},
"senderAgentID": {
"type": "integer"
},
"status": {
"$ref": "#/definitions/entity.KindBoxReqStatus"
"kind_box_req": {
"$ref": "#/definitions/entity.KindBoxReq"
}
}
},
@ -1407,14 +1398,17 @@ const docTemplate = `{
"param.PaginationResponse": {
"type": "object",
"properties": {
"pageNumber": {
"type": "integer"
"page_number": {
"type": "integer",
"example": 1
},
"pageSize": {
"type": "integer"
"page_size": {
"type": "integer",
"example": 10
},
"total": {
"type": "integer"
"type": "integer",
"example": 100
}
}
}

View File

@ -785,7 +785,7 @@
"adminkindboxreqparam.KindBoxReqGetAllResponse": {
"type": "object",
"properties": {
"allKindBoxReq": {
"all_kind_box_req": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.KindBoxReq"
@ -854,31 +854,52 @@
"type": "object",
"properties": {
"description": {
"type": "string"
"type": "string",
"example": "This is a description"
},
"email": {
"type": "string"
"type": "string",
"example": "example@gmail.com"
},
"first_name": {
"type": "string"
"type": "string",
"example": "John"
},
"gender": {
"$ref": "#/definitions/entity.Gender"
"allOf": [
{
"$ref": "#/definitions/entity.Gender"
}
],
"example": 1
},
"id": {
"type": "integer"
"type": "integer",
"example": 1
},
"last_name": {
"type": "string"
"type": "string",
"example": "Doe"
},
"phone_number": {
"type": "string"
"type": "string",
"example": "09123456789"
},
"role": {
"$ref": "#/definitions/entity.AdminRole"
"allOf": [
{
"$ref": "#/definitions/entity.AdminRole"
}
],
"example": 2
},
"status": {
"$ref": "#/definitions/entity.AdminStatus"
"allOf": [
{
"$ref": "#/definitions/entity.AdminStatus"
}
],
"example": 1
}
}
},
@ -1146,38 +1167,8 @@
"benefactorkindboxreqparam.KindBoxReqGetResponse": {
"type": "object",
"properties": {
"benefactorID": {
"type": "integer"
},
"countAccepted": {
"type": "integer"
},
"countRequested": {
"type": "integer"
},
"deliverAddressID": {
"type": "integer"
},
"deliverReferDate": {
"type": "string"
},
"deliveredAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"kindBoxType": {
"$ref": "#/definitions/entity.KindBoxType"
},
"senderAgentID": {
"type": "integer"
},
"status": {
"$ref": "#/definitions/entity.KindBoxReqStatus"
"kind_box_req": {
"$ref": "#/definitions/entity.KindBoxReq"
}
}
},
@ -1396,14 +1387,17 @@
"param.PaginationResponse": {
"type": "object",
"properties": {
"pageNumber": {
"type": "integer"
"page_number": {
"type": "integer",
"example": 1
},
"pageSize": {
"type": "integer"
"page_size": {
"type": "integer",
"example": 10
},
"total": {
"type": "integer"
"type": "integer",
"example": 100
}
}
}

View File

@ -73,7 +73,7 @@ definitions:
type: object
adminkindboxreqparam.KindBoxReqGetAllResponse:
properties:
allKindBoxReq:
all_kind_box_req:
items:
$ref: '#/definitions/entity.KindBoxReq'
type: array
@ -118,23 +118,35 @@ definitions:
adminserviceparam.AdminInfo:
properties:
description:
example: This is a description
type: string
email:
example: example@gmail.com
type: string
first_name:
example: John
type: string
gender:
$ref: '#/definitions/entity.Gender'
allOf:
- $ref: '#/definitions/entity.Gender'
example: 1
id:
example: 1
type: integer
last_name:
example: Doe
type: string
phone_number:
example: "09123456789"
type: string
role:
$ref: '#/definitions/entity.AdminRole'
allOf:
- $ref: '#/definitions/entity.AdminRole'
example: 2
status:
$ref: '#/definitions/entity.AdminStatus'
allOf:
- $ref: '#/definitions/entity.AdminStatus'
example: 1
type: object
adminserviceparam.LoginWithPhoneNumberRequest:
properties:
@ -309,28 +321,8 @@ definitions:
type: object
benefactorkindboxreqparam.KindBoxReqGetResponse:
properties:
benefactorID:
type: integer
countAccepted:
type: integer
countRequested:
type: integer
deliverAddressID:
type: integer
deliverReferDate:
type: string
deliveredAt:
type: string
description:
type: string
id:
type: integer
kindBoxType:
$ref: '#/definitions/entity.KindBoxType'
senderAgentID:
type: integer
status:
$ref: '#/definitions/entity.KindBoxReqStatus'
kind_box_req:
$ref: '#/definitions/entity.KindBoxReq'
type: object
entity.Address:
properties:
@ -483,11 +475,14 @@ definitions:
type: object
param.PaginationResponse:
properties:
pageNumber:
page_number:
example: 1
type: integer
pageSize:
page_size:
example: 10
type: integer
total:
example: 100
type: integer
type: object
info:

View File

@ -13,13 +13,13 @@ type LoginWithPhoneNumberResponse struct {
}
type AdminInfo struct {
ID uint `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
PhoneNumber string `json:"phone_number"`
Role entity.AdminRole `json:"role"`
Description string `json:"description"`
Email string `json:"email"`
Gender entity.Gender `json:"gender"`
Status entity.AdminStatus `json:"status"`
ID uint `json:"id" example:"1"`
FirstName string `json:"first_name" example:"John"`
LastName string `json:"last_name" example:"Doe"`
PhoneNumber string `json:"phone_number" example:"09123456789"`
Role entity.AdminRole `json:"role" example:"2"`
Description string `json:"description" example:"This is a description"`
Email string `json:"email" example:"example@gmail.com"`
Gender entity.Gender `json:"gender" example:"1"`
Status entity.AdminStatus `json:"status" example:"1"`
}

View File

@ -15,5 +15,5 @@ type RegisterRequest struct {
}
type RegisterResponse struct {
Admin entity.Admin
Admin entity.Admin `json:"admin"`
}

View File

@ -8,6 +8,6 @@ import (
type KindBoxReqGetAllRequest struct{}
type KindBoxReqGetAllResponse struct {
AllKindBoxReq []entity.KindBoxReq
Pagination paginationparam.PaginationResponse
AllKindBoxReq []entity.KindBoxReq `json:"all_kind_box_req"`
Pagination paginationparam.PaginationResponse `json:"pagination"`
}

View File

@ -8,5 +8,5 @@ type KindBoxReqGetRequest struct {
}
type KindBoxReqGetResponse struct {
entity.KindBoxReq
entity.KindBoxReq `json:"kind_box_req"`
}

View File

@ -7,5 +7,5 @@ type KindBoxReqGetAllRequest struct {
}
type KindBoxReqGetAllResponse struct {
AllKindBoxReq []entity.KindBoxReq
AllKindBoxReq []entity.KindBoxReq `json:"all_kind_box_req"`
}

View File

@ -11,9 +11,9 @@ type PaginationRequest struct {
}
type PaginationResponse struct {
PageSize uint
PageNumber uint
Total uint
PageSize uint `json:"page_size" example:"10"`
PageNumber uint `json:"page_number" example:"1"`
Total uint `json:"total" example:"100"`
}
func (p *PaginationRequest) GetPageNumber() uint {