forked from ebhomengo/niki
fix(niki): add benefactor_id filter to avoid getting all kindboxes
This commit is contained in:
parent
0e92213d2e
commit
3dd67e0f83
|
|
@ -19,7 +19,7 @@ import (
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param id path int true "Benefactor ID"
|
// @Param id path int true "Benefactor ID"
|
||||||
// @Success 200 {object} param.GetBenefactorByIDResponse
|
// @Success 200 {object} BenefactorAggregatedResponse
|
||||||
// @Failure 400 {string} "Bad request"
|
// @Failure 400 {string} "Bad request"
|
||||||
// @Failure 401 {string} "invalid or expired jwt"
|
// @Failure 401 {string} "invalid or expired jwt"
|
||||||
// @Failure 403 {string} "user not allowed"
|
// @Failure 403 {string} "user not allowed"
|
||||||
|
|
@ -58,6 +58,9 @@ func (h Handler) GetBenefactor(c echo.Context) error {
|
||||||
Field: "created_at",
|
Field: "created_at",
|
||||||
Direction: params.DescSortDirection,
|
Direction: params.DescSortDirection,
|
||||||
},
|
},
|
||||||
|
Filter: map[string]any{
|
||||||
|
"benefactor_id": bnf.Data.ID,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg, code := httpmsg.Error(err)
|
msg, code := httpmsg.Error(err)
|
||||||
|
|
@ -74,6 +77,9 @@ func (h Handler) GetBenefactor(c echo.Context) error {
|
||||||
Field: "created_at",
|
Field: "created_at",
|
||||||
Direction: params.DescSortDirection,
|
Direction: params.DescSortDirection,
|
||||||
},
|
},
|
||||||
|
Filter: map[string]any{
|
||||||
|
"benefactor_id": bnf.Data.ID,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg, code := httpmsg.Error(err)
|
msg, code := httpmsg.Error(err)
|
||||||
|
|
|
||||||
62
docs/docs.go
62
docs/docs.go
|
|
@ -215,7 +215,7 @@ const docTemplate = `{
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.GetBenefactorByIDResponse"
|
"$ref": "#/definitions/adminbenefactorhandler.BenefactorAggregatedResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
|
@ -3046,6 +3046,38 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"adminaddressparam.Data": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"benefactor_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"city_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"lat": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"lon": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"postal_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"province_id": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"adminagentparam.Data": {
|
"adminagentparam.Data": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -3130,11 +3162,37 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adminbenefactoreparam.GetBenefactorByIDResponse": {
|
"adminbenefactorhandler.BenefactorAggregatedResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"data": {
|
"data": {
|
||||||
|
"$ref": "#/definitions/adminbenefactorhandler.Data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminbenefactorhandler.Data": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"addresses": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminaddressparam.Data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
|
},
|
||||||
|
"kind_box_reqs": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxreqparam.Data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"kind_boxes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxparam.Data"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.GetBenefactorByIDResponse"
|
"$ref": "#/definitions/adminbenefactorhandler.BenefactorAggregatedResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
|
@ -3035,6 +3035,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"adminaddressparam.Data": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"benefactor_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"city_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"lat": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"lon": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"postal_code": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"province_id": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"adminagentparam.Data": {
|
"adminagentparam.Data": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -3119,11 +3151,37 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adminbenefactoreparam.GetBenefactorByIDResponse": {
|
"adminbenefactorhandler.BenefactorAggregatedResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"data": {
|
"data": {
|
||||||
|
"$ref": "#/definitions/adminbenefactorhandler.Data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminbenefactorhandler.Data": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"addresses": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminaddressparam.Data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
|
},
|
||||||
|
"kind_box_reqs": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxreqparam.Data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"kind_boxes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxparam.Data"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,27 @@ definitions:
|
||||||
example: "1234567890"
|
example: "1234567890"
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
adminaddressparam.Data:
|
||||||
|
properties:
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
benefactor_id:
|
||||||
|
type: integer
|
||||||
|
city_id:
|
||||||
|
type: integer
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
lat:
|
||||||
|
type: number
|
||||||
|
lon:
|
||||||
|
type: number
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
postal_code:
|
||||||
|
type: string
|
||||||
|
province_id:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
adminagentparam.Data:
|
adminagentparam.Data:
|
||||||
properties:
|
properties:
|
||||||
first_name:
|
first_name:
|
||||||
|
|
@ -157,10 +178,27 @@ definitions:
|
||||||
status:
|
status:
|
||||||
$ref: '#/definitions/entity.BenefactorStatus'
|
$ref: '#/definitions/entity.BenefactorStatus'
|
||||||
type: object
|
type: object
|
||||||
adminbenefactoreparam.GetBenefactorByIDResponse:
|
adminbenefactorhandler.BenefactorAggregatedResponse:
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
|
$ref: '#/definitions/adminbenefactorhandler.Data'
|
||||||
|
type: object
|
||||||
|
adminbenefactorhandler.Data:
|
||||||
|
properties:
|
||||||
|
addresses:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/adminaddressparam.Data'
|
||||||
|
type: array
|
||||||
|
benefactor:
|
||||||
$ref: '#/definitions/adminbenefactoreparam.Data'
|
$ref: '#/definitions/adminbenefactoreparam.Data'
|
||||||
|
kind_box_reqs:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/adminkindboxreqparam.Data'
|
||||||
|
type: array
|
||||||
|
kind_boxes:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/adminkindboxparam.Data'
|
||||||
|
type: array
|
||||||
type: object
|
type: object
|
||||||
adminkindboxparam.AssignReceiverRequest:
|
adminkindboxparam.AssignReceiverRequest:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -1174,7 +1212,7 @@ paths:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/adminbenefactoreparam.GetBenefactorByIDResponse'
|
$ref: '#/definitions/adminbenefactorhandler.BenefactorAggregatedResponse'
|
||||||
"400":
|
"400":
|
||||||
description: Bad request
|
description: Bad request
|
||||||
schema:
|
schema:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue