refactor(admin): change aggregation response struct

This commit is contained in:
Hamed Xamani 2024-11-27 16:47:02 +03:30
parent 7aa381c113
commit 16c83e1368
16 changed files with 950 additions and 473 deletions

View File

@ -6,12 +6,8 @@ import (
adminprovinceparam "git.gocasts.ir/ebhomengo/niki/param/admin/province"
)
type Info struct {
type Address struct {
Address param.Data `json:"address"`
Province adminprovinceparam.Data `json:"province"`
City admincityparam.Data `json:"city"`
}
type Address struct {
Address param.Data `json:"address"`
Info Info `json:"info"`
}

View File

@ -1,19 +1,25 @@
package adminbenefactorhandler
import (
"time"
"git.gocasts.ir/ebhomengo/niki/entity"
adminaddressparam "git.gocasts.ir/ebhomengo/niki/param/admin/address"
param "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
adminkindboxparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
adminkindboxreqparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
)
type Info struct {
type BenefactorAggregatedResponse struct {
ID uint `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
PhoneNumber string `json:"phone_number"`
Description string `json:"description"`
Email string `json:"email"`
Gender entity.Gender `json:"gender"`
BirthDate *time.Time `json:"birth_date"`
Status entity.BenefactorStatus `json:"status"`
Addresses []adminaddressparam.Data `json:"addresses"`
KindBoxes []adminkindboxparam.Data `json:"kind_boxes"`
KindBoxReqs []adminkindboxreqparam.Data `json:"kind_box_reqs"`
}
type BenefactorAggregatedResponse struct {
Benefactor param.Data `json:"benefactor"`
Info Info `json:"info"`
}

View File

@ -88,12 +88,18 @@ func (h Handler) GetBenefactor(c echo.Context) error {
}
resp := BenefactorAggregatedResponse{
Benefactor: bnf.Data,
Info: Info{
ID: bnf.Data.ID,
FirstName: bnf.Data.FirstName,
LastName: bnf.Data.LastName,
PhoneNumber: bnf.Data.PhoneNumber,
Description: bnf.Data.Description,
Email: bnf.Data.Email,
Gender: bnf.Data.Gender,
BirthDate: bnf.Data.BirthDate,
Status: bnf.Data.Status,
Addresses: addresses.Data,
KindBoxes: kindBoxes.Data,
KindBoxReqs: kindBoxReqs.Data,
},
}
return c.JSON(http.StatusOK, resp)

View File

@ -1,13 +1,33 @@
package adminkindboxhandler
import (
"time"
adminaddresshandler "git.gocasts.ir/ebhomengo/niki/delivery/http_server/admin/address"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/param"
adminbenefactorparam "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
adminrefertimeparam "git.gocasts.ir/ebhomengo/niki/param/admin/refer_time"
)
type Info struct {
type KindBoxAggregatedResponse struct {
ID uint `json:"id"`
KindBoxReqID uint `json:"kind_box_req_id"`
BenefactorID uint `json:"benefactor_id"`
KindBoxType entity.KindBoxType `json:"kind_box_type"`
Amount uint `json:"amount"`
SerialNumber string `json:"serial_number"`
Status entity.KindBoxStatus `json:"status"`
DeliverReferTimeID uint `json:"deliver_refer_time_id"`
DeliverReferDate time.Time `json:"deliver_refer_date"`
DeliverAddressID uint `json:"deliver_address_id"`
SenderAgentID uint `json:"sender_agent_id"`
DeliveredAt time.Time `json:"delivered_at"`
ReturnReferTimeID uint `json:"return_refer_time_id"`
ReturnReferDate *time.Time `json:"return_refer_date"`
ReturnAddressID uint `json:"return_address_id"`
ReceiverAgentID uint `json:"receiver_agent_id"`
ReturnedAt *time.Time `json:"returned_at"`
Benefactor adminbenefactorparam.Data `json:"benefactor"`
DeliverAddress adminaddresshandler.Address `json:"deliver_address"`
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
@ -15,7 +35,31 @@ type Info struct {
ReturnReferTime adminrefertimeparam.Data `json:"return_refer_time"`
}
type KindBoxAggregatedResponse struct {
KindBox param.Data `json:"kind_box"`
Info Info `json:"info"`
type KindBoxAggregatedListResponse struct {
ID uint `json:"id"`
KindBoxReqID uint `json:"kind_box_req_id"`
BenefactorID uint `json:"benefactor_id"`
KindBoxType entity.KindBoxType `json:"kind_box_type"`
Amount uint `json:"amount"`
SerialNumber string `json:"serial_number"`
Status entity.KindBoxStatus `json:"status"`
DeliverReferTimeID uint `json:"deliver_refer_time_id"`
DeliverReferDate time.Time `json:"deliver_refer_date"`
DeliverAddressID uint `json:"deliver_address_id"`
SenderAgentID uint `json:"sender_agent_id"`
DeliveredAt time.Time `json:"delivered_at"`
ReturnReferTimeID uint `json:"return_refer_time_id"`
ReturnReferDate *time.Time `json:"return_refer_date"`
ReturnAddressID uint `json:"return_address_id"`
ReceiverAgentID uint `json:"receiver_agent_id"`
ReturnedAt *time.Time `json:"returned_at"`
Benefactor adminbenefactorparam.Data `json:"benefactor"`
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
ReturnReferTime adminrefertimeparam.Data `json:"return_refer_time"`
}
type KindBoxesAggregatedResponse struct {
Data []KindBoxAggregatedListResponse `json:"data"`
Pagination param.PaginationResponse `json:"pagination"`
FieldErrors map[string]string `json:"field_errors,omitempty"`
}

View File

@ -45,11 +45,6 @@ func (h Handler) Get(c echo.Context) error {
benefactor, bErr := h.adminBenefactorAggSvc.GetByID(c.Request().Context(), kindBox.Data.BenefactorID)
if bErr != nil {
msg, code := httpmsg.Error(bErr)
if kindBox.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
@ -57,22 +52,12 @@ func (h Handler) Get(c echo.Context) error {
deliverAddress, dAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBox.Data.DeliverAddressID)
if dAErr != nil {
msg, code := httpmsg.Error(dAErr)
if kindBox.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
returnAddress, rAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBox.Data.ReturnAddressID)
if rAErr != nil {
msg, code := httpmsg.Error(rAErr)
if kindBox.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
@ -80,11 +65,6 @@ func (h Handler) Get(c echo.Context) error {
deliverReferTime, dRErr := h.referTimeAggSvc.GetReferTimeByID(c.Request().Context(), kindBox.Data.DeliverReferTimeID)
if dRErr != nil {
msg, code := httpmsg.Error(dRErr)
if kindBox.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
@ -92,24 +72,33 @@ func (h Handler) Get(c echo.Context) error {
returnReferTime, rRErr := h.referTimeAggSvc.GetReferTimeByID(c.Request().Context(), kindBox.Data.ReturnReferTimeID)
if rRErr != nil {
msg, code := httpmsg.Error(rRErr)
if kindBox.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
resp := KindBoxAggregatedResponse{
KindBox: kindBox.Data,
Info: Info{
ID: kindBox.Data.ID,
KindBoxReqID: kindBox.Data.KindBoxReqID,
BenefactorID: kindBox.Data.BenefactorID,
KindBoxType: kindBox.Data.KindBoxType,
Amount: kindBox.Data.Amount,
SerialNumber: kindBox.Data.SerialNumber,
Status: kindBox.Data.Status,
DeliverReferTimeID: kindBox.Data.DeliverReferTimeID,
DeliverReferDate: kindBox.Data.DeliverReferDate,
DeliverAddressID: kindBox.Data.DeliverAddressID,
SenderAgentID: kindBox.Data.SenderAgentID,
DeliveredAt: kindBox.Data.DeliveredAt,
ReturnReferTimeID: kindBox.Data.ReturnReferTimeID,
ReturnReferDate: kindBox.Data.ReturnReferDate,
ReturnAddressID: kindBox.Data.ReturnAddressID,
ReceiverAgentID: kindBox.Data.ReceiverAgentID,
ReturnedAt: kindBox.Data.ReturnedAt,
Benefactor: benefactor,
DeliverAddress: deliverAddress,
ReturnAddress: returnAddress,
DeliverReferTime: deliverReferTime,
ReturnReferTime: returnReferTime,
},
}
return c.JSON(http.StatusOK, resp)

View File

@ -38,7 +38,7 @@ import (
// @Param page_size query int false "Page size"
// @Param sort_field query string false "Sort by field" Enums(id,kind_box_req_id,benefactor_id,kind_box_type,amount,serial_number,status,delivered_at,return_refer_time_id,return_refer_date,return_address_id,receiver_agent_id,returned_at,sender_agent_id,deliver_refer_date,deliver_address_id,deliver_refer_time_id)
// @Param sort_direction query string false "Sort order" Enums(asc,desc)
// @Success 200 {object} param.KindBoxGetAllResponse
// @Success 200 {array} KindBoxesAggregatedResponse
// @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin
// @Router /admins/kindboxes [get].
@ -51,54 +51,70 @@ func (h Handler) GetAll(c echo.Context) error {
req.Filter = queryparam.GetFilterParams(c)
kindboxes, sErr := h.adminKindBoxSvc.GetAll(c.Request().Context(), req)
kindBoxes, sErr := h.adminKindBoxSvc.GetAll(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
if kindboxes.FieldErrors != nil {
if kindBoxes.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
"errors": kindboxes.FieldErrors,
"errors": kindBoxes.FieldErrors,
})
}
return echo.NewHTTPError(code, msg)
}
benefactors, bErr := h.adminBenefactorAggSvc.GetByIDs(c.Request().Context(), getBenefactorIDs(kindboxes.Data))
benefactors, bErr := h.adminBenefactorAggSvc.GetByIDs(c.Request().Context(), getBenefactorIDs(kindBoxes.Data))
if bErr != nil {
msg, code := httpmsg.Error(sErr)
if kindboxes.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
"errors": kindboxes.FieldErrors,
})
}
return echo.NewHTTPError(code, msg)
}
deliverReferTime, dRErr := h.referTimeAggSvc.GetReferTimeByIDs(c.Request().Context(), getDeliverReferTimeIDs(kindboxes.Data))
deliverReferTime, dRErr := h.referTimeAggSvc.GetReferTimeByIDs(c.Request().Context(), getDeliverReferTimeIDs(kindBoxes.Data))
if dRErr != nil {
msg, code := httpmsg.Error(dRErr)
return echo.NewHTTPError(code, msg)
}
returnReferTime, rRErr := h.referTimeAggSvc.GetReferTimeByIDs(c.Request().Context(), getReturnReferTimeIDs(kindboxes.Data))
returnReferTime, rRErr := h.referTimeAggSvc.GetReferTimeByIDs(c.Request().Context(), getReturnReferTimeIDs(kindBoxes.Data))
if rRErr != nil {
msg, code := httpmsg.Error(rRErr)
return echo.NewHTTPError(code, msg)
}
resp := param.KindBoxGetAllResponse{
Data: kindboxes.Data,
Info: param.Info{
Benefactors: benefactors,
DeliverReferTimes: deliverReferTime,
ReturnReferTimes: returnReferTime,
},
Pagination: kindboxes.Pagination,
var data []KindBoxAggregatedListResponse
for _, kindBox := range kindBoxes.Data {
data = append(data, KindBoxAggregatedListResponse{
ID: kindBox.ID,
KindBoxReqID: kindBox.KindBoxReqID,
BenefactorID: kindBox.BenefactorID,
KindBoxType: kindBox.KindBoxType,
Amount: kindBox.Amount,
SerialNumber: kindBox.SerialNumber,
Status: kindBox.Status,
DeliverReferTimeID: kindBox.DeliverReferTimeID,
DeliverReferDate: kindBox.DeliverReferDate,
DeliverAddressID: kindBox.DeliverAddressID,
SenderAgentID: kindBox.SenderAgentID,
DeliveredAt: kindBox.DeliveredAt,
ReturnReferTimeID: kindBox.ReturnReferTimeID,
ReturnReferDate: kindBox.ReturnReferDate,
ReturnAddressID: kindBox.ReturnAddressID,
ReceiverAgentID: kindBox.ReceiverAgentID,
ReturnedAt: kindBox.ReturnedAt,
Benefactor: benefactors[kindBox.BenefactorID],
DeliverReferTime: deliverReferTime[kindBox.DeliverReferTimeID],
ReturnReferTime: returnReferTime[kindBox.ReturnReferTimeID],
})
}
resp := KindBoxesAggregatedResponse{
Data: data,
Pagination: kindBoxes.Pagination,
}
return c.JSON(http.StatusOK, resp)
}

View File

@ -1,19 +1,51 @@
package adminkindboxreqhandler
import (
"time"
adminaddresshandler "git.gocasts.ir/ebhomengo/niki/delivery/http_server/admin/address"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/param"
adminbenefactorparam "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
adminrefertimeparam "git.gocasts.ir/ebhomengo/niki/param/admin/refer_time"
)
type Info struct {
type KindBoxReqAggregatedResponse struct {
ID uint `json:"id"`
BenefactorID uint `json:"benefactor_id"`
KindBoxType entity.KindBoxType `json:"kind_box_type"`
CountRequested uint `json:"count_requested"`
CountAccepted uint `json:"count_accepted"`
Description string `json:"description"`
Status entity.KindBoxReqStatus `json:"status"`
DeliverReferTimeID uint `json:"deliver_refer_time_id"`
DeliverReferDate time.Time `json:"deliver_refer_date"`
DeliverAddressID uint `json:"deliver_address_id"`
SenderAgentID uint `json:"sender_agent_id"`
DeliveredAt *time.Time `json:"delivered_at"`
Benefactor adminbenefactorparam.Data `json:"benefactor"`
DeliverAddress adminaddresshandler.Address `json:"deliver_address"`
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
}
type KindBoxReqAggregatedResponse struct {
KindBoxReq param.Data `json:"kind_box_req"`
Info Info `json:"info"`
type KindBoxReqAggregatedListResponse struct {
ID uint `json:"id"`
BenefactorID uint `json:"benefactor_id"`
KindBoxType entity.KindBoxType `json:"kind_box_type"`
CountRequested uint `json:"count_requested"`
CountAccepted uint `json:"count_accepted"`
Description string `json:"description"`
Status entity.KindBoxReqStatus `json:"status"`
DeliverReferTimeID uint `json:"deliver_refer_time_id"`
DeliverReferDate time.Time `json:"deliver_refer_date"`
DeliverAddressID uint `json:"deliver_address_id"`
SenderAgentID uint `json:"sender_agent_id"`
DeliveredAt *time.Time `json:"delivered_at"`
Benefactor adminbenefactorparam.Data `json:"benefactor"`
}
type KindBoxReqsAggregatedResponse struct {
Data []KindBoxReqAggregatedListResponse `json:"data"`
Pagination param.PaginationResponse `json:"pagination"`
FieldErrors map[string]string `json:"field_errors,omitempty"`
}

View File

@ -44,11 +44,6 @@ func (h Handler) Get(c echo.Context) error {
benefactor, bErr := h.adminBenefactorAggSvc.GetByID(c.Request().Context(), kindBoxReq.Data.BenefactorID)
if bErr != nil {
msg, code := httpmsg.Error(bErr)
if kindBoxReq.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
@ -56,11 +51,6 @@ func (h Handler) Get(c echo.Context) error {
deliverAddress, dAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBoxReq.Data.DeliverAddressID)
if dAErr != nil {
msg, code := httpmsg.Error(dAErr)
if kindBoxReq.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
@ -68,22 +58,26 @@ func (h Handler) Get(c echo.Context) error {
deliverReferTime, dRErr := h.referTimeAggSvc.GetReferTimeByID(c.Request().Context(), kindBoxReq.Data.DeliverReferTimeID)
if dRErr != nil {
msg, code := httpmsg.Error(dRErr)
if kindBoxReq.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
})
}
return echo.NewHTTPError(code, msg)
}
resp := KindBoxReqAggregatedResponse{
KindBoxReq: kindBoxReq.Data,
Info: Info{
ID: kindBoxReq.Data.ID,
BenefactorID: kindBoxReq.Data.BenefactorID,
KindBoxType: kindBoxReq.Data.KindBoxType,
CountRequested: kindBoxReq.Data.CountRequested,
CountAccepted: kindBoxReq.Data.CountAccepted,
Description: kindBoxReq.Data.Description,
Status: kindBoxReq.Data.Status,
DeliverReferTimeID: kindBoxReq.Data.DeliverReferTimeID,
DeliverReferDate: kindBoxReq.Data.DeliverReferDate,
DeliverAddressID: kindBoxReq.Data.DeliverAddressID,
SenderAgentID: kindBoxReq.Data.SenderAgentID,
DeliveredAt: kindBoxReq.Data.DeliveredAt,
Benefactor: benefactor,
DeliverAddress: deliverAddress,
DeliverReferTime: deliverReferTime,
},
}
return c.JSON(http.StatusOK, resp)
}

View File

@ -32,7 +32,7 @@ import (
// @Param page_size query int false "Page size"
// @Param sort_field query string false "Sort by field" Enums(id,benefactor_id,sender_agent_id,kind_box_type,status,count_requested,count_accepted,deliver_refer_time_id,deliver_refer_date,deliver_address_id,delivered_at)
// @Param sort_direction query string false "Sort order" Enums(asc,desc)
// @Success 200 {object} param.KindBoxReqGetAllResponse
// @Success 200 {array} KindBoxReqsAggregatedResponse
// @Failure 400 {string} "Bad Request"
// @Failure 401 {string} "invalid or expired jwt"
// @Failure 403 {string} "user not allowed"
@ -65,21 +65,30 @@ func (h Handler) GetAll(c echo.Context) error {
benefactors, bErr := h.adminBenefactorAggSvc.GetByIDs(c.Request().Context(), getBenefactorIDs(kindBoxReqs.Data))
if bErr != nil {
msg, code := httpmsg.Error(bErr)
if kindBoxReqs.FieldErrors != nil {
return c.JSON(code, echo.Map{
"message": msg,
"errors": kindBoxReqs.FieldErrors,
})
}
return echo.NewHTTPError(code, msg)
}
var data []KindBoxReqAggregatedListResponse
resp := param.KindBoxReqGetAllResponse{
Data: kindBoxReqs.Data,
Info: param.Info{
Benefactors: benefactors,
},
for _, kindBoxReq := range kindBoxReqs.Data {
data = append(data, KindBoxReqAggregatedListResponse{
ID: kindBoxReq.ID,
BenefactorID: kindBoxReq.BenefactorID,
KindBoxType: kindBoxReq.KindBoxType,
CountRequested: kindBoxReq.CountRequested,
CountAccepted: kindBoxReq.CountAccepted,
Description: kindBoxReq.Description,
Status: kindBoxReq.Status,
DeliverReferTimeID: kindBoxReq.DeliverReferTimeID,
DeliverReferDate: kindBoxReq.DeliverReferDate,
DeliverAddressID: kindBoxReq.DeliverAddressID,
SenderAgentID: kindBoxReq.SenderAgentID,
DeliveredAt: kindBoxReq.DeliveredAt,
Benefactor: benefactors[kindBoxReq.BenefactorID],
})
}
resp := KindBoxReqsAggregatedResponse{
Data: data,
Pagination: kindBoxReqs.Pagination,
}
return c.JSON(http.StatusOK, resp)

View File

@ -596,7 +596,10 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/adminkindboxparam.KindBoxGetAllResponse"
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxhandler.KindBoxesAggregatedResponse"
}
}
},
"400": {
@ -1020,7 +1023,10 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/adminkindboxreqparam.KindBoxReqGetAllResponse"
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxreqhandler.KindBoxReqsAggregatedResponse"
}
}
},
"400": {
@ -3238,14 +3244,6 @@ const docTemplate = `{
"address": {
"$ref": "#/definitions/adminaddressparam.Data"
},
"info": {
"$ref": "#/definitions/adminaddresshandler.Info"
}
}
},
"adminaddresshandler.Info": {
"type": "object",
"properties": {
"city": {
"$ref": "#/definitions/admincityparam.Data"
},
@ -3387,17 +3385,6 @@ const docTemplate = `{
}
},
"adminbenefactorhandler.BenefactorAggregatedResponse": {
"type": "object",
"properties": {
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"info": {
"$ref": "#/definitions/adminbenefactorhandler.Info"
}
}
},
"adminbenefactorhandler.Info": {
"type": "object",
"properties": {
"addresses": {
@ -3406,6 +3393,24 @@ const docTemplate = `{
"$ref": "#/definitions/adminaddressparam.Data"
}
},
"birth_date": {
"type": "string"
},
"description": {
"type": "string"
},
"email": {
"type": "string"
},
"first_name": {
"type": "string"
},
"gender": {
"$ref": "#/definitions/entity.Gender"
},
"id": {
"type": "integer"
},
"kind_box_reqs": {
"type": "array",
"items": {
@ -3417,6 +3422,15 @@ const docTemplate = `{
"items": {
"$ref": "#/definitions/adminkindboxparam.Data"
}
},
"last_name": {
"type": "string"
},
"phone_number": {
"type": "string"
},
"status": {
"$ref": "#/definitions/entity.BenefactorStatus"
}
}
},
@ -3434,34 +3448,159 @@ const docTemplate = `{
}
}
},
"adminkindboxhandler.Info": {
"adminkindboxhandler.KindBoxAggregatedListResponse": {
"type": "object",
"properties": {
"amount": {
"type": "integer"
},
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
"benefactor_id": {
"type": "integer"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"return_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_req_id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"receiver_agent_id": {
"type": "integer"
},
"return_address_id": {
"type": "integer"
},
"return_refer_date": {
"type": "string"
},
"return_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"return_refer_time_id": {
"type": "integer"
},
"returned_at": {
"type": "string"
},
"sender_agent_id": {
"type": "integer"
},
"serial_number": {
"type": "string"
},
"status": {
"$ref": "#/definitions/entity.KindBoxStatus"
}
}
},
"adminkindboxhandler.KindBoxAggregatedResponse": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/adminkindboxhandler.Info"
"amount": {
"type": "integer"
},
"kind_box": {
"$ref": "#/definitions/adminkindboxparam.Data"
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"benefactor_id": {
"type": "integer"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_req_id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"receiver_agent_id": {
"type": "integer"
},
"return_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
},
"return_address_id": {
"type": "integer"
},
"return_refer_date": {
"type": "string"
},
"return_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"return_refer_time_id": {
"type": "integer"
},
"returned_at": {
"type": "string"
},
"sender_agent_id": {
"type": "integer"
},
"serial_number": {
"type": "string"
},
"status": {
"$ref": "#/definitions/entity.KindBoxStatus"
}
}
},
"adminkindboxhandler.KindBoxesAggregatedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxhandler.KindBoxAggregatedListResponse"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
@ -3537,52 +3676,6 @@ const docTemplate = `{
}
}
},
"adminkindboxparam.Info": {
"type": "object",
"properties": {
"benefactors": {
"type": "array",
"items": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
}
},
"deliver_refer_times": {
"type": "array",
"items": {
"$ref": "#/definitions/adminrefertimeparam.Data"
}
},
"return-refer-times": {
"type": "array",
"items": {
"$ref": "#/definitions/adminrefertimeparam.Data"
}
}
}
},
"adminkindboxparam.KindBoxGetAllResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxparam.Data"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"info": {
"$ref": "#/definitions/adminkindboxparam.Info"
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
"adminkindboxparam.KindBoxUpdateRequest": {
"type": "object",
"properties": {
@ -3612,28 +3705,117 @@ const docTemplate = `{
}
}
},
"adminkindboxreqhandler.Info": {
"adminkindboxreqhandler.KindBoxReqAggregatedListResponse": {
"type": "object",
"properties": {
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
"benefactor_id": {
"type": "integer"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
"count_accepted": {
"type": "integer"
},
"count_requested": {
"type": "integer"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"sender_agent_id": {
"type": "integer"
},
"status": {
"$ref": "#/definitions/entity.KindBoxReqStatus"
}
}
},
"adminkindboxreqhandler.KindBoxReqAggregatedResponse": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/adminkindboxreqhandler.Info"
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"kind_box_req": {
"$ref": "#/definitions/adminkindboxreqparam.Data"
"benefactor_id": {
"type": "integer"
},
"count_accepted": {
"type": "integer"
},
"count_requested": {
"type": "integer"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"sender_agent_id": {
"type": "integer"
},
"status": {
"$ref": "#/definitions/entity.KindBoxReqStatus"
}
}
},
"adminkindboxreqhandler.KindBoxReqsAggregatedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxreqhandler.KindBoxReqAggregatedListResponse"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
@ -3697,17 +3879,6 @@ const docTemplate = `{
}
}
},
"adminkindboxreqparam.Info": {
"type": "object",
"properties": {
"benefactors": {
"type": "array",
"items": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
}
}
}
},
"adminkindboxreqparam.KindBoxReqAcceptRequest": {
"type": "object",
"properties": {
@ -3777,29 +3948,6 @@ const docTemplate = `{
}
}
},
"adminkindboxreqparam.KindBoxReqGetAllResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxreqparam.Data"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"info": {
"$ref": "#/definitions/adminkindboxreqparam.Info"
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
"adminkindboxreqparam.KindBoxReqRejectRequest": {
"type": "object",
"properties": {

View File

@ -585,7 +585,10 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/adminkindboxparam.KindBoxGetAllResponse"
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxhandler.KindBoxesAggregatedResponse"
}
}
},
"400": {
@ -1009,7 +1012,10 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/adminkindboxreqparam.KindBoxReqGetAllResponse"
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxreqhandler.KindBoxReqsAggregatedResponse"
}
}
},
"400": {
@ -3227,14 +3233,6 @@
"address": {
"$ref": "#/definitions/adminaddressparam.Data"
},
"info": {
"$ref": "#/definitions/adminaddresshandler.Info"
}
}
},
"adminaddresshandler.Info": {
"type": "object",
"properties": {
"city": {
"$ref": "#/definitions/admincityparam.Data"
},
@ -3376,17 +3374,6 @@
}
},
"adminbenefactorhandler.BenefactorAggregatedResponse": {
"type": "object",
"properties": {
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"info": {
"$ref": "#/definitions/adminbenefactorhandler.Info"
}
}
},
"adminbenefactorhandler.Info": {
"type": "object",
"properties": {
"addresses": {
@ -3395,6 +3382,24 @@
"$ref": "#/definitions/adminaddressparam.Data"
}
},
"birth_date": {
"type": "string"
},
"description": {
"type": "string"
},
"email": {
"type": "string"
},
"first_name": {
"type": "string"
},
"gender": {
"$ref": "#/definitions/entity.Gender"
},
"id": {
"type": "integer"
},
"kind_box_reqs": {
"type": "array",
"items": {
@ -3406,6 +3411,15 @@
"items": {
"$ref": "#/definitions/adminkindboxparam.Data"
}
},
"last_name": {
"type": "string"
},
"phone_number": {
"type": "string"
},
"status": {
"$ref": "#/definitions/entity.BenefactorStatus"
}
}
},
@ -3423,34 +3437,159 @@
}
}
},
"adminkindboxhandler.Info": {
"adminkindboxhandler.KindBoxAggregatedListResponse": {
"type": "object",
"properties": {
"amount": {
"type": "integer"
},
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
"benefactor_id": {
"type": "integer"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"return_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_req_id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"receiver_agent_id": {
"type": "integer"
},
"return_address_id": {
"type": "integer"
},
"return_refer_date": {
"type": "string"
},
"return_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"return_refer_time_id": {
"type": "integer"
},
"returned_at": {
"type": "string"
},
"sender_agent_id": {
"type": "integer"
},
"serial_number": {
"type": "string"
},
"status": {
"$ref": "#/definitions/entity.KindBoxStatus"
}
}
},
"adminkindboxhandler.KindBoxAggregatedResponse": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/adminkindboxhandler.Info"
"amount": {
"type": "integer"
},
"kind_box": {
"$ref": "#/definitions/adminkindboxparam.Data"
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"benefactor_id": {
"type": "integer"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_req_id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"receiver_agent_id": {
"type": "integer"
},
"return_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
},
"return_address_id": {
"type": "integer"
},
"return_refer_date": {
"type": "string"
},
"return_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"return_refer_time_id": {
"type": "integer"
},
"returned_at": {
"type": "string"
},
"sender_agent_id": {
"type": "integer"
},
"serial_number": {
"type": "string"
},
"status": {
"$ref": "#/definitions/entity.KindBoxStatus"
}
}
},
"adminkindboxhandler.KindBoxesAggregatedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxhandler.KindBoxAggregatedListResponse"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
@ -3526,52 +3665,6 @@
}
}
},
"adminkindboxparam.Info": {
"type": "object",
"properties": {
"benefactors": {
"type": "array",
"items": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
}
},
"deliver_refer_times": {
"type": "array",
"items": {
"$ref": "#/definitions/adminrefertimeparam.Data"
}
},
"return-refer-times": {
"type": "array",
"items": {
"$ref": "#/definitions/adminrefertimeparam.Data"
}
}
}
},
"adminkindboxparam.KindBoxGetAllResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxparam.Data"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"info": {
"$ref": "#/definitions/adminkindboxparam.Info"
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
"adminkindboxparam.KindBoxUpdateRequest": {
"type": "object",
"properties": {
@ -3601,28 +3694,117 @@
}
}
},
"adminkindboxreqhandler.Info": {
"adminkindboxreqhandler.KindBoxReqAggregatedListResponse": {
"type": "object",
"properties": {
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
"benefactor_id": {
"type": "integer"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
"count_accepted": {
"type": "integer"
},
"count_requested": {
"type": "integer"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"sender_agent_id": {
"type": "integer"
},
"status": {
"$ref": "#/definitions/entity.KindBoxReqStatus"
}
}
},
"adminkindboxreqhandler.KindBoxReqAggregatedResponse": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/adminkindboxreqhandler.Info"
"benefactor": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
},
"kind_box_req": {
"$ref": "#/definitions/adminkindboxreqparam.Data"
"benefactor_id": {
"type": "integer"
},
"count_accepted": {
"type": "integer"
},
"count_requested": {
"type": "integer"
},
"deliver_address": {
"$ref": "#/definitions/adminaddresshandler.Address"
},
"deliver_address_id": {
"type": "integer"
},
"deliver_refer_date": {
"type": "string"
},
"deliver_refer_time": {
"$ref": "#/definitions/adminrefertimeparam.Data"
},
"deliver_refer_time_id": {
"type": "integer"
},
"delivered_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"kind_box_type": {
"$ref": "#/definitions/entity.KindBoxType"
},
"sender_agent_id": {
"type": "integer"
},
"status": {
"$ref": "#/definitions/entity.KindBoxReqStatus"
}
}
},
"adminkindboxreqhandler.KindBoxReqsAggregatedResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxreqhandler.KindBoxReqAggregatedListResponse"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
@ -3686,17 +3868,6 @@
}
}
},
"adminkindboxreqparam.Info": {
"type": "object",
"properties": {
"benefactors": {
"type": "array",
"items": {
"$ref": "#/definitions/adminbenefactoreparam.Data"
}
}
}
},
"adminkindboxreqparam.KindBoxReqAcceptRequest": {
"type": "object",
"properties": {
@ -3766,29 +3937,6 @@
}
}
},
"adminkindboxreqparam.KindBoxReqGetAllResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/adminkindboxreqparam.Data"
}
},
"field_errors": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"info": {
"$ref": "#/definitions/adminkindboxreqparam.Info"
},
"pagination": {
"$ref": "#/definitions/param.PaginationResponse"
}
}
},
"adminkindboxreqparam.KindBoxReqRejectRequest": {
"type": "object",
"properties": {

View File

@ -105,11 +105,6 @@ definitions:
properties:
address:
$ref: '#/definitions/adminaddressparam.Data'
info:
$ref: '#/definitions/adminaddresshandler.Info'
type: object
adminaddresshandler.Info:
properties:
city:
$ref: '#/definitions/admincityparam.Data'
province:
@ -202,18 +197,23 @@ definitions:
$ref: '#/definitions/entity.BenefactorStatus'
type: object
adminbenefactorhandler.BenefactorAggregatedResponse:
properties:
benefactor:
$ref: '#/definitions/adminbenefactoreparam.Data'
info:
$ref: '#/definitions/adminbenefactorhandler.Info'
type: object
adminbenefactorhandler.Info:
properties:
addresses:
items:
$ref: '#/definitions/adminaddressparam.Data'
type: array
birth_date:
type: string
description:
type: string
email:
type: string
first_name:
type: string
gender:
$ref: '#/definitions/entity.Gender'
id:
type: integer
kind_box_reqs:
items:
$ref: '#/definitions/adminkindboxreqparam.Data'
@ -222,6 +222,12 @@ definitions:
items:
$ref: '#/definitions/adminkindboxparam.Data'
type: array
last_name:
type: string
phone_number:
type: string
status:
$ref: '#/definitions/entity.BenefactorStatus'
type: object
admincityparam.Data:
properties:
@ -232,25 +238,108 @@ definitions:
province_id:
type: integer
type: object
adminkindboxhandler.Info:
adminkindboxhandler.KindBoxAggregatedListResponse:
properties:
amount:
type: integer
benefactor:
$ref: '#/definitions/adminbenefactoreparam.Data'
deliver_address:
$ref: '#/definitions/adminaddresshandler.Address'
benefactor_id:
type: integer
deliver_address_id:
type: integer
deliver_refer_date:
type: string
deliver_refer_time:
$ref: '#/definitions/adminrefertimeparam.Data'
return_address:
$ref: '#/definitions/adminaddresshandler.Address'
deliver_refer_time_id:
type: integer
delivered_at:
type: string
id:
type: integer
kind_box_req_id:
type: integer
kind_box_type:
$ref: '#/definitions/entity.KindBoxType'
receiver_agent_id:
type: integer
return_address_id:
type: integer
return_refer_date:
type: string
return_refer_time:
$ref: '#/definitions/adminrefertimeparam.Data'
return_refer_time_id:
type: integer
returned_at:
type: string
sender_agent_id:
type: integer
serial_number:
type: string
status:
$ref: '#/definitions/entity.KindBoxStatus'
type: object
adminkindboxhandler.KindBoxAggregatedResponse:
properties:
info:
$ref: '#/definitions/adminkindboxhandler.Info'
kind_box:
$ref: '#/definitions/adminkindboxparam.Data'
amount:
type: integer
benefactor:
$ref: '#/definitions/adminbenefactoreparam.Data'
benefactor_id:
type: integer
deliver_address:
$ref: '#/definitions/adminaddresshandler.Address'
deliver_address_id:
type: integer
deliver_refer_date:
type: string
deliver_refer_time:
$ref: '#/definitions/adminrefertimeparam.Data'
deliver_refer_time_id:
type: integer
delivered_at:
type: string
id:
type: integer
kind_box_req_id:
type: integer
kind_box_type:
$ref: '#/definitions/entity.KindBoxType'
receiver_agent_id:
type: integer
return_address:
$ref: '#/definitions/adminaddresshandler.Address'
return_address_id:
type: integer
return_refer_date:
type: string
return_refer_time:
$ref: '#/definitions/adminrefertimeparam.Data'
return_refer_time_id:
type: integer
returned_at:
type: string
sender_agent_id:
type: integer
serial_number:
type: string
status:
$ref: '#/definitions/entity.KindBoxStatus'
type: object
adminkindboxhandler.KindBoxesAggregatedResponse:
properties:
data:
items:
$ref: '#/definitions/adminkindboxhandler.KindBoxAggregatedListResponse'
type: array
field_errors:
additionalProperties:
type: string
type: object
pagination:
$ref: '#/definitions/param.PaginationResponse'
type: object
adminkindboxparam.AssignReceiverRequest:
properties:
@ -299,36 +388,6 @@ definitions:
amount:
type: integer
type: object
adminkindboxparam.Info:
properties:
benefactors:
items:
$ref: '#/definitions/adminbenefactoreparam.Data'
type: array
deliver_refer_times:
items:
$ref: '#/definitions/adminrefertimeparam.Data'
type: array
return-refer-times:
items:
$ref: '#/definitions/adminrefertimeparam.Data'
type: array
type: object
adminkindboxparam.KindBoxGetAllResponse:
properties:
data:
items:
$ref: '#/definitions/adminkindboxparam.Data'
type: array
field_errors:
additionalProperties:
type: string
type: object
info:
$ref: '#/definitions/adminkindboxparam.Info'
pagination:
$ref: '#/definitions/param.PaginationResponse'
type: object
adminkindboxparam.KindBoxUpdateRequest:
properties:
amount:
@ -350,21 +409,80 @@ definitions:
example: 3
type: integer
type: object
adminkindboxreqhandler.Info:
adminkindboxreqhandler.KindBoxReqAggregatedListResponse:
properties:
benefactor:
$ref: '#/definitions/adminbenefactoreparam.Data'
deliver_address:
$ref: '#/definitions/adminaddresshandler.Address'
deliver_refer_time:
$ref: '#/definitions/adminrefertimeparam.Data'
benefactor_id:
type: integer
count_accepted:
type: integer
count_requested:
type: integer
deliver_address_id:
type: integer
deliver_refer_date:
type: string
deliver_refer_time_id:
type: integer
delivered_at:
type: string
description:
type: string
id:
type: integer
kind_box_type:
$ref: '#/definitions/entity.KindBoxType'
sender_agent_id:
type: integer
status:
$ref: '#/definitions/entity.KindBoxReqStatus'
type: object
adminkindboxreqhandler.KindBoxReqAggregatedResponse:
properties:
info:
$ref: '#/definitions/adminkindboxreqhandler.Info'
kind_box_req:
$ref: '#/definitions/adminkindboxreqparam.Data'
benefactor:
$ref: '#/definitions/adminbenefactoreparam.Data'
benefactor_id:
type: integer
count_accepted:
type: integer
count_requested:
type: integer
deliver_address:
$ref: '#/definitions/adminaddresshandler.Address'
deliver_address_id:
type: integer
deliver_refer_date:
type: string
deliver_refer_time:
$ref: '#/definitions/adminrefertimeparam.Data'
deliver_refer_time_id:
type: integer
delivered_at:
type: string
description:
type: string
id:
type: integer
kind_box_type:
$ref: '#/definitions/entity.KindBoxType'
sender_agent_id:
type: integer
status:
$ref: '#/definitions/entity.KindBoxReqStatus'
type: object
adminkindboxreqhandler.KindBoxReqsAggregatedResponse:
properties:
data:
items:
$ref: '#/definitions/adminkindboxreqhandler.KindBoxReqAggregatedListResponse'
type: array
field_errors:
additionalProperties:
type: string
type: object
pagination:
$ref: '#/definitions/param.PaginationResponse'
type: object
adminkindboxreqparam.AssignSenderRequest:
properties:
@ -405,13 +523,6 @@ definitions:
status:
$ref: '#/definitions/entity.KindBoxReqStatus'
type: object
adminkindboxreqparam.Info:
properties:
benefactors:
items:
$ref: '#/definitions/adminbenefactoreparam.Data'
type: array
type: object
adminkindboxreqparam.KindBoxReqAcceptRequest:
properties:
count_accepted:
@ -457,21 +568,6 @@ definitions:
type: string
type: object
type: object
adminkindboxreqparam.KindBoxReqGetAllResponse:
properties:
data:
items:
$ref: '#/definitions/adminkindboxreqparam.Data'
type: array
field_errors:
additionalProperties:
type: string
type: object
info:
$ref: '#/definitions/adminkindboxreqparam.Info'
pagination:
$ref: '#/definitions/param.PaginationResponse'
type: object
adminkindboxreqparam.KindBoxReqRejectRequest:
properties:
description:
@ -1568,7 +1664,9 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/adminkindboxparam.KindBoxGetAllResponse'
items:
$ref: '#/definitions/adminkindboxhandler.KindBoxesAggregatedResponse'
type: array
"400":
description: Bad request
schema:
@ -1849,7 +1947,9 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/adminkindboxreqparam.KindBoxReqGetAllResponse'
items:
$ref: '#/definitions/adminkindboxreqhandler.KindBoxReqsAggregatedResponse'
type: array
"400":
description: Bad Request
schema:

View File

@ -2,8 +2,6 @@ package adminkindboxparam
import (
"git.gocasts.ir/ebhomengo/niki/param"
adminbenefactoreparam "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
adminrefertimeparam "git.gocasts.ir/ebhomengo/niki/param/admin/refer_time"
)
type KindBoxGetAllRequest struct {
@ -13,15 +11,8 @@ type KindBoxGetAllRequest struct {
Search param.SearchRequest
}
type Info struct {
Benefactors []adminbenefactoreparam.Data `json:"benefactors"`
DeliverReferTimes []adminrefertimeparam.Data `json:"deliver_refer_times"`
ReturnReferTimes []adminrefertimeparam.Data `json:"return-refer-times"`
}
type KindBoxGetAllResponse struct {
Data []Data `json:"data"`
Info Info `json:"info"`
Pagination param.PaginationResponse `json:"pagination"`
FieldErrors map[string]string `json:"field_errors,omitempty"`
}

View File

@ -29,7 +29,6 @@ func (s Service) GetAggregatedByID(ctx context.Context, addressID uint) (adminad
ProvinceID: address.Address.ProvinceID,
BenefactorID: address.Address.BenefactorID,
},
Info: adminaddresshandler.Info{
Province: adminprovinceparam.Data{
ID: address.Province.ID,
Name: address.Province.Name,
@ -39,6 +38,5 @@ func (s Service) GetAggregatedByID(ctx context.Context, addressID uint) (adminad
Name: address.City.Name,
ProvinceId: address.City.ProvinceID,
},
},
}, nil
}

View File

@ -8,16 +8,16 @@ import (
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (s Service) GetByIDs(ctx context.Context, ids []any) ([]param.Data, error) {
func (s Service) GetByIDs(ctx context.Context, ids []any) (map[uint]param.Data, error) {
const op = "adminbenefactoraggregatorservice.GetByIDs"
var data []param.Data
data := make(map[uint]param.Data)
benefactors, err := s.repo.GetByIDs(ctx, ids)
if err != nil {
return nil, richerror.New(op).WithErr(err)
}
for _, benefactor := range benefactors {
data = append(data, param.Data{
data[benefactor.ID] = param.Data{
ID: benefactor.ID,
FirstName: benefactor.FirstName,
LastName: benefactor.LastName,
@ -27,7 +27,7 @@ func (s Service) GetByIDs(ctx context.Context, ids []any) ([]param.Data, error)
Gender: benefactor.Gender,
BirthDate: response.GetNullDate(benefactor.BirthDate),
Status: benefactor.Status,
})
}
}
return data, nil
}

View File

@ -7,20 +7,20 @@ import (
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (s Service) GetReferTimeByIDs(ctx context.Context, ids []any) ([]param.Data, error) {
func (s Service) GetReferTimeByIDs(ctx context.Context, ids []any) (map[uint]param.Data, error) {
const op = "adminrefertimeaggregatorservice.GetReferTimeByIDs"
var data []param.Data
data := make(map[uint]param.Data)
referTimes, err := s.repo.GetByIDs(ctx, ids)
if err != nil {
return nil, richerror.New(op).WithErr(err)
}
for _, referTime := range referTimes {
data = append(data, param.Data{
data[referTime.ID] = param.Data{
ID: referTime.ID,
Status: referTime.Status,
Duration: referTime.Duration,
})
}
}
return data, nil
}