forked from ebhomengo/niki
Merge pull request 'refactor(admin): change aggregation response struct' (#214) from stage/hamed/change-agg-struck into develop
Reviewed-on: ebhomengo/niki#214
This commit is contained in:
commit
e7ea933038
|
|
@ -6,12 +6,8 @@ import (
|
||||||
adminprovinceparam "git.gocasts.ir/ebhomengo/niki/param/admin/province"
|
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"`
|
Province adminprovinceparam.Data `json:"province"`
|
||||||
City admincityparam.Data `json:"city"`
|
City admincityparam.Data `json:"city"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Address struct {
|
|
||||||
Address param.Data `json:"address"`
|
|
||||||
Info Info `json:"info"`
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,25 @@
|
||||||
package adminbenefactorhandler
|
package adminbenefactorhandler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.gocasts.ir/ebhomengo/niki/entity"
|
||||||
adminaddressparam "git.gocasts.ir/ebhomengo/niki/param/admin/address"
|
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"
|
adminkindboxparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
|
||||||
adminkindboxreqparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
|
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"`
|
Addresses []adminaddressparam.Data `json:"addresses"`
|
||||||
KindBoxes []adminkindboxparam.Data `json:"kind_boxes"`
|
KindBoxes []adminkindboxparam.Data `json:"kind_boxes"`
|
||||||
KindBoxReqs []adminkindboxreqparam.Data `json:"kind_box_reqs"`
|
KindBoxReqs []adminkindboxreqparam.Data `json:"kind_box_reqs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BenefactorAggregatedResponse struct {
|
|
||||||
Benefactor param.Data `json:"benefactor"`
|
|
||||||
Info Info `json:"info"`
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -88,12 +88,18 @@ func (h Handler) GetBenefactor(c echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := BenefactorAggregatedResponse{
|
resp := BenefactorAggregatedResponse{
|
||||||
Benefactor: bnf.Data,
|
ID: bnf.Data.ID,
|
||||||
Info: Info{
|
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,
|
Addresses: addresses.Data,
|
||||||
KindBoxes: kindBoxes.Data,
|
KindBoxes: kindBoxes.Data,
|
||||||
KindBoxReqs: kindBoxReqs.Data,
|
KindBoxReqs: kindBoxReqs.Data,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, resp)
|
return c.JSON(http.StatusOK, resp)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,33 @@
|
||||||
package adminkindboxhandler
|
package adminkindboxhandler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
adminaddresshandler "git.gocasts.ir/ebhomengo/niki/delivery/http_server/admin/address"
|
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"
|
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"
|
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"`
|
Benefactor adminbenefactorparam.Data `json:"benefactor"`
|
||||||
DeliverAddress adminaddresshandler.Address `json:"deliver_address"`
|
DeliverAddress adminaddresshandler.Address `json:"deliver_address"`
|
||||||
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
|
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
|
||||||
|
|
@ -15,7 +35,31 @@ type Info struct {
|
||||||
ReturnReferTime adminrefertimeparam.Data `json:"return_refer_time"`
|
ReturnReferTime adminrefertimeparam.Data `json:"return_refer_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KindBoxAggregatedResponse struct {
|
type KindBoxAggregatedListResponse struct {
|
||||||
KindBox param.Data `json:"kind_box"`
|
ID uint `json:"id"`
|
||||||
Info Info `json:"info"`
|
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"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,6 @@ func (h Handler) Get(c echo.Context) error {
|
||||||
benefactor, bErr := h.adminBenefactorAggSvc.GetByID(c.Request().Context(), kindBox.Data.BenefactorID)
|
benefactor, bErr := h.adminBenefactorAggSvc.GetByID(c.Request().Context(), kindBox.Data.BenefactorID)
|
||||||
if bErr != nil {
|
if bErr != nil {
|
||||||
msg, code := httpmsg.Error(bErr)
|
msg, code := httpmsg.Error(bErr)
|
||||||
if kindBox.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, 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)
|
deliverAddress, dAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBox.Data.DeliverAddressID)
|
||||||
if dAErr != nil {
|
if dAErr != nil {
|
||||||
msg, code := httpmsg.Error(dAErr)
|
msg, code := httpmsg.Error(dAErr)
|
||||||
if kindBox.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, msg)
|
return echo.NewHTTPError(code, msg)
|
||||||
}
|
}
|
||||||
returnAddress, rAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBox.Data.ReturnAddressID)
|
returnAddress, rAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBox.Data.ReturnAddressID)
|
||||||
if rAErr != nil {
|
if rAErr != nil {
|
||||||
msg, code := httpmsg.Error(rAErr)
|
msg, code := httpmsg.Error(rAErr)
|
||||||
if kindBox.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, 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)
|
deliverReferTime, dRErr := h.referTimeAggSvc.GetReferTimeByID(c.Request().Context(), kindBox.Data.DeliverReferTimeID)
|
||||||
if dRErr != nil {
|
if dRErr != nil {
|
||||||
msg, code := httpmsg.Error(dRErr)
|
msg, code := httpmsg.Error(dRErr)
|
||||||
if kindBox.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, 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)
|
returnReferTime, rRErr := h.referTimeAggSvc.GetReferTimeByID(c.Request().Context(), kindBox.Data.ReturnReferTimeID)
|
||||||
if rRErr != nil {
|
if rRErr != nil {
|
||||||
msg, code := httpmsg.Error(rRErr)
|
msg, code := httpmsg.Error(rRErr)
|
||||||
if kindBox.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, msg)
|
return echo.NewHTTPError(code, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := KindBoxAggregatedResponse{
|
resp := KindBoxAggregatedResponse{
|
||||||
KindBox: kindBox.Data,
|
ID: kindBox.Data.ID,
|
||||||
Info: Info{
|
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,
|
Benefactor: benefactor,
|
||||||
DeliverAddress: deliverAddress,
|
DeliverAddress: deliverAddress,
|
||||||
ReturnAddress: returnAddress,
|
ReturnAddress: returnAddress,
|
||||||
DeliverReferTime: deliverReferTime,
|
DeliverReferTime: deliverReferTime,
|
||||||
ReturnReferTime: returnReferTime,
|
ReturnReferTime: returnReferTime,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, resp)
|
return c.JSON(http.StatusOK, resp)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import (
|
||||||
// @Param page_size query int false "Page size"
|
// @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_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)
|
// @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"
|
// @Failure 400 {string} "Bad request"
|
||||||
// @Security AuthBearerAdmin
|
// @Security AuthBearerAdmin
|
||||||
// @Router /admins/kindboxes [get].
|
// @Router /admins/kindboxes [get].
|
||||||
|
|
@ -51,54 +51,70 @@ func (h Handler) GetAll(c echo.Context) error {
|
||||||
|
|
||||||
req.Filter = queryparam.GetFilterParams(c)
|
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 {
|
if sErr != nil {
|
||||||
msg, code := httpmsg.Error(sErr)
|
msg, code := httpmsg.Error(sErr)
|
||||||
if kindboxes.FieldErrors != nil {
|
if kindBoxes.FieldErrors != nil {
|
||||||
return c.JSON(code, echo.Map{
|
return c.JSON(code, echo.Map{
|
||||||
"message": msg,
|
"message": msg,
|
||||||
"errors": kindboxes.FieldErrors,
|
"errors": kindBoxes.FieldErrors,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return echo.NewHTTPError(code, msg)
|
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 {
|
if bErr != nil {
|
||||||
msg, code := httpmsg.Error(sErr)
|
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)
|
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 {
|
if dRErr != nil {
|
||||||
msg, code := httpmsg.Error(dRErr)
|
msg, code := httpmsg.Error(dRErr)
|
||||||
|
|
||||||
return echo.NewHTTPError(code, msg)
|
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 {
|
if rRErr != nil {
|
||||||
msg, code := httpmsg.Error(rRErr)
|
msg, code := httpmsg.Error(rRErr)
|
||||||
|
|
||||||
return echo.NewHTTPError(code, msg)
|
return echo.NewHTTPError(code, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := param.KindBoxGetAllResponse{
|
var data []KindBoxAggregatedListResponse
|
||||||
Data: kindboxes.Data,
|
|
||||||
Info: param.Info{
|
for _, kindBox := range kindBoxes.Data {
|
||||||
Benefactors: benefactors,
|
data = append(data, KindBoxAggregatedListResponse{
|
||||||
DeliverReferTimes: deliverReferTime,
|
ID: kindBox.ID,
|
||||||
ReturnReferTimes: returnReferTime,
|
KindBoxReqID: kindBox.KindBoxReqID,
|
||||||
},
|
BenefactorID: kindBox.BenefactorID,
|
||||||
Pagination: kindboxes.Pagination,
|
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)
|
return c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,51 @@
|
||||||
package adminkindboxreqhandler
|
package adminkindboxreqhandler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
adminaddresshandler "git.gocasts.ir/ebhomengo/niki/delivery/http_server/admin/address"
|
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"
|
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"
|
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"`
|
Benefactor adminbenefactorparam.Data `json:"benefactor"`
|
||||||
DeliverAddress adminaddresshandler.Address `json:"deliver_address"`
|
DeliverAddress adminaddresshandler.Address `json:"deliver_address"`
|
||||||
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
|
DeliverReferTime adminrefertimeparam.Data `json:"deliver_refer_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KindBoxReqAggregatedResponse struct {
|
type KindBoxReqAggregatedListResponse struct {
|
||||||
KindBoxReq param.Data `json:"kind_box_req"`
|
ID uint `json:"id"`
|
||||||
Info Info `json:"info"`
|
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"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,6 @@ func (h Handler) Get(c echo.Context) error {
|
||||||
benefactor, bErr := h.adminBenefactorAggSvc.GetByID(c.Request().Context(), kindBoxReq.Data.BenefactorID)
|
benefactor, bErr := h.adminBenefactorAggSvc.GetByID(c.Request().Context(), kindBoxReq.Data.BenefactorID)
|
||||||
if bErr != nil {
|
if bErr != nil {
|
||||||
msg, code := httpmsg.Error(bErr)
|
msg, code := httpmsg.Error(bErr)
|
||||||
if kindBoxReq.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, 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)
|
deliverAddress, dAErr := h.addressAggSvc.GetAggregatedByID(c.Request().Context(), kindBoxReq.Data.DeliverAddressID)
|
||||||
if dAErr != nil {
|
if dAErr != nil {
|
||||||
msg, code := httpmsg.Error(dAErr)
|
msg, code := httpmsg.Error(dAErr)
|
||||||
if kindBoxReq.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, 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)
|
deliverReferTime, dRErr := h.referTimeAggSvc.GetReferTimeByID(c.Request().Context(), kindBoxReq.Data.DeliverReferTimeID)
|
||||||
if dRErr != nil {
|
if dRErr != nil {
|
||||||
msg, code := httpmsg.Error(dRErr)
|
msg, code := httpmsg.Error(dRErr)
|
||||||
if kindBoxReq.FieldErrors != nil {
|
|
||||||
return c.JSON(code, echo.Map{
|
|
||||||
"message": msg,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return echo.NewHTTPError(code, msg)
|
return echo.NewHTTPError(code, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := KindBoxReqAggregatedResponse{
|
resp := KindBoxReqAggregatedResponse{
|
||||||
KindBoxReq: kindBoxReq.Data,
|
ID: kindBoxReq.Data.ID,
|
||||||
Info: Info{
|
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,
|
Benefactor: benefactor,
|
||||||
DeliverAddress: deliverAddress,
|
DeliverAddress: deliverAddress,
|
||||||
DeliverReferTime: deliverReferTime,
|
DeliverReferTime: deliverReferTime,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
return c.JSON(http.StatusOK, resp)
|
return c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import (
|
||||||
// @Param page_size query int false "Page size"
|
// @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_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)
|
// @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 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"
|
||||||
|
|
@ -65,21 +65,30 @@ func (h Handler) GetAll(c echo.Context) error {
|
||||||
benefactors, bErr := h.adminBenefactorAggSvc.GetByIDs(c.Request().Context(), getBenefactorIDs(kindBoxReqs.Data))
|
benefactors, bErr := h.adminBenefactorAggSvc.GetByIDs(c.Request().Context(), getBenefactorIDs(kindBoxReqs.Data))
|
||||||
if bErr != nil {
|
if bErr != nil {
|
||||||
msg, code := httpmsg.Error(bErr)
|
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)
|
return echo.NewHTTPError(code, msg)
|
||||||
}
|
}
|
||||||
|
var data []KindBoxReqAggregatedListResponse
|
||||||
|
|
||||||
resp := param.KindBoxReqGetAllResponse{
|
for _, kindBoxReq := range kindBoxReqs.Data {
|
||||||
Data: kindBoxReqs.Data,
|
data = append(data, KindBoxReqAggregatedListResponse{
|
||||||
Info: param.Info{
|
ID: kindBoxReq.ID,
|
||||||
Benefactors: benefactors,
|
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,
|
Pagination: kindBoxReqs.Pagination,
|
||||||
}
|
}
|
||||||
return c.JSON(http.StatusOK, resp)
|
return c.JSON(http.StatusOK, resp)
|
||||||
|
|
|
||||||
386
docs/docs.go
386
docs/docs.go
|
|
@ -596,7 +596,10 @@ const docTemplate = `{
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/adminkindboxparam.KindBoxGetAllResponse"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxhandler.KindBoxesAggregatedResponse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
|
@ -1020,7 +1023,10 @@ const docTemplate = `{
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/adminkindboxreqparam.KindBoxReqGetAllResponse"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxreqhandler.KindBoxReqsAggregatedResponse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
|
@ -3238,14 +3244,6 @@ const docTemplate = `{
|
||||||
"address": {
|
"address": {
|
||||||
"$ref": "#/definitions/adminaddressparam.Data"
|
"$ref": "#/definitions/adminaddressparam.Data"
|
||||||
},
|
},
|
||||||
"info": {
|
|
||||||
"$ref": "#/definitions/adminaddresshandler.Info"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"adminaddresshandler.Info": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"city": {
|
"city": {
|
||||||
"$ref": "#/definitions/admincityparam.Data"
|
"$ref": "#/definitions/admincityparam.Data"
|
||||||
},
|
},
|
||||||
|
|
@ -3387,17 +3385,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adminbenefactorhandler.BenefactorAggregatedResponse": {
|
"adminbenefactorhandler.BenefactorAggregatedResponse": {
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"benefactor": {
|
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
|
||||||
},
|
|
||||||
"info": {
|
|
||||||
"$ref": "#/definitions/adminbenefactorhandler.Info"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"adminbenefactorhandler.Info": {
|
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"addresses": {
|
"addresses": {
|
||||||
|
|
@ -3406,6 +3393,24 @@ const docTemplate = `{
|
||||||
"$ref": "#/definitions/adminaddressparam.Data"
|
"$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": {
|
"kind_box_reqs": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|
@ -3417,6 +3422,15 @@ const docTemplate = `{
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/adminkindboxparam.Data"
|
"$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",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"amount": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"benefactor": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
},
|
},
|
||||||
"deliver_address": {
|
"benefactor_id": {
|
||||||
"$ref": "#/definitions/adminaddresshandler.Address"
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"deliver_address_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"deliver_refer_date": {
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deliver_refer_time": {
|
"deliver_refer_time": {
|
||||||
"$ref": "#/definitions/adminrefertimeparam.Data"
|
"$ref": "#/definitions/adminrefertimeparam.Data"
|
||||||
},
|
},
|
||||||
"return_address": {
|
"deliver_refer_time_id": {
|
||||||
"$ref": "#/definitions/adminaddresshandler.Address"
|
"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": {
|
"return_refer_time": {
|
||||||
"$ref": "#/definitions/adminrefertimeparam.Data"
|
"$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": {
|
"adminkindboxhandler.KindBoxAggregatedResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"info": {
|
"amount": {
|
||||||
"$ref": "#/definitions/adminkindboxhandler.Info"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"kind_box": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminkindboxparam.Data"
|
"$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": {
|
"adminkindboxparam.KindBoxUpdateRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -3612,28 +3705,117 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adminkindboxreqhandler.Info": {
|
"adminkindboxreqhandler.KindBoxReqAggregatedListResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"benefactor": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
},
|
},
|
||||||
"deliver_address": {
|
"benefactor_id": {
|
||||||
"$ref": "#/definitions/adminaddresshandler.Address"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"deliver_refer_time": {
|
"count_accepted": {
|
||||||
"$ref": "#/definitions/adminrefertimeparam.Data"
|
"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": {
|
"adminkindboxreqhandler.KindBoxReqAggregatedResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"info": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminkindboxreqhandler.Info"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
},
|
},
|
||||||
"kind_box_req": {
|
"benefactor_id": {
|
||||||
"$ref": "#/definitions/adminkindboxreqparam.Data"
|
"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": {
|
"adminkindboxreqparam.KindBoxReqAcceptRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"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": {
|
"adminkindboxreqparam.KindBoxReqRejectRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,10 @@
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/adminkindboxparam.KindBoxGetAllResponse"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxhandler.KindBoxesAggregatedResponse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
|
@ -1009,7 +1012,10 @@
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/adminkindboxreqparam.KindBoxReqGetAllResponse"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/adminkindboxreqhandler.KindBoxReqsAggregatedResponse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
|
@ -3227,14 +3233,6 @@
|
||||||
"address": {
|
"address": {
|
||||||
"$ref": "#/definitions/adminaddressparam.Data"
|
"$ref": "#/definitions/adminaddressparam.Data"
|
||||||
},
|
},
|
||||||
"info": {
|
|
||||||
"$ref": "#/definitions/adminaddresshandler.Info"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"adminaddresshandler.Info": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"city": {
|
"city": {
|
||||||
"$ref": "#/definitions/admincityparam.Data"
|
"$ref": "#/definitions/admincityparam.Data"
|
||||||
},
|
},
|
||||||
|
|
@ -3376,17 +3374,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adminbenefactorhandler.BenefactorAggregatedResponse": {
|
"adminbenefactorhandler.BenefactorAggregatedResponse": {
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"benefactor": {
|
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
|
||||||
},
|
|
||||||
"info": {
|
|
||||||
"$ref": "#/definitions/adminbenefactorhandler.Info"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"adminbenefactorhandler.Info": {
|
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"addresses": {
|
"addresses": {
|
||||||
|
|
@ -3395,6 +3382,24 @@
|
||||||
"$ref": "#/definitions/adminaddressparam.Data"
|
"$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": {
|
"kind_box_reqs": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|
@ -3406,6 +3411,15 @@
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/adminkindboxparam.Data"
|
"$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",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"amount": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"benefactor": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
},
|
},
|
||||||
"deliver_address": {
|
"benefactor_id": {
|
||||||
"$ref": "#/definitions/adminaddresshandler.Address"
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"deliver_address_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"deliver_refer_date": {
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deliver_refer_time": {
|
"deliver_refer_time": {
|
||||||
"$ref": "#/definitions/adminrefertimeparam.Data"
|
"$ref": "#/definitions/adminrefertimeparam.Data"
|
||||||
},
|
},
|
||||||
"return_address": {
|
"deliver_refer_time_id": {
|
||||||
"$ref": "#/definitions/adminaddresshandler.Address"
|
"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": {
|
"return_refer_time": {
|
||||||
"$ref": "#/definitions/adminrefertimeparam.Data"
|
"$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": {
|
"adminkindboxhandler.KindBoxAggregatedResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"info": {
|
"amount": {
|
||||||
"$ref": "#/definitions/adminkindboxhandler.Info"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"kind_box": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminkindboxparam.Data"
|
"$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": {
|
"adminkindboxparam.KindBoxUpdateRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -3601,28 +3694,117 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"adminkindboxreqhandler.Info": {
|
"adminkindboxreqhandler.KindBoxReqAggregatedListResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"benefactor": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
},
|
},
|
||||||
"deliver_address": {
|
"benefactor_id": {
|
||||||
"$ref": "#/definitions/adminaddresshandler.Address"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"deliver_refer_time": {
|
"count_accepted": {
|
||||||
"$ref": "#/definitions/adminrefertimeparam.Data"
|
"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": {
|
"adminkindboxreqhandler.KindBoxReqAggregatedResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"info": {
|
"benefactor": {
|
||||||
"$ref": "#/definitions/adminkindboxreqhandler.Info"
|
"$ref": "#/definitions/adminbenefactoreparam.Data"
|
||||||
},
|
},
|
||||||
"kind_box_req": {
|
"benefactor_id": {
|
||||||
"$ref": "#/definitions/adminkindboxreqparam.Data"
|
"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": {
|
"adminkindboxreqparam.KindBoxReqAcceptRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"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": {
|
"adminkindboxreqparam.KindBoxReqRejectRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,6 @@ definitions:
|
||||||
properties:
|
properties:
|
||||||
address:
|
address:
|
||||||
$ref: '#/definitions/adminaddressparam.Data'
|
$ref: '#/definitions/adminaddressparam.Data'
|
||||||
info:
|
|
||||||
$ref: '#/definitions/adminaddresshandler.Info'
|
|
||||||
type: object
|
|
||||||
adminaddresshandler.Info:
|
|
||||||
properties:
|
|
||||||
city:
|
city:
|
||||||
$ref: '#/definitions/admincityparam.Data'
|
$ref: '#/definitions/admincityparam.Data'
|
||||||
province:
|
province:
|
||||||
|
|
@ -202,18 +197,23 @@ definitions:
|
||||||
$ref: '#/definitions/entity.BenefactorStatus'
|
$ref: '#/definitions/entity.BenefactorStatus'
|
||||||
type: object
|
type: object
|
||||||
adminbenefactorhandler.BenefactorAggregatedResponse:
|
adminbenefactorhandler.BenefactorAggregatedResponse:
|
||||||
properties:
|
|
||||||
benefactor:
|
|
||||||
$ref: '#/definitions/adminbenefactoreparam.Data'
|
|
||||||
info:
|
|
||||||
$ref: '#/definitions/adminbenefactorhandler.Info'
|
|
||||||
type: object
|
|
||||||
adminbenefactorhandler.Info:
|
|
||||||
properties:
|
properties:
|
||||||
addresses:
|
addresses:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/adminaddressparam.Data'
|
$ref: '#/definitions/adminaddressparam.Data'
|
||||||
type: array
|
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:
|
kind_box_reqs:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/adminkindboxreqparam.Data'
|
$ref: '#/definitions/adminkindboxreqparam.Data'
|
||||||
|
|
@ -222,6 +222,12 @@ definitions:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/adminkindboxparam.Data'
|
$ref: '#/definitions/adminkindboxparam.Data'
|
||||||
type: array
|
type: array
|
||||||
|
last_name:
|
||||||
|
type: string
|
||||||
|
phone_number:
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
$ref: '#/definitions/entity.BenefactorStatus'
|
||||||
type: object
|
type: object
|
||||||
admincityparam.Data:
|
admincityparam.Data:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -232,25 +238,108 @@ definitions:
|
||||||
province_id:
|
province_id:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
adminkindboxhandler.Info:
|
adminkindboxhandler.KindBoxAggregatedListResponse:
|
||||||
properties:
|
properties:
|
||||||
|
amount:
|
||||||
|
type: integer
|
||||||
benefactor:
|
benefactor:
|
||||||
$ref: '#/definitions/adminbenefactoreparam.Data'
|
$ref: '#/definitions/adminbenefactoreparam.Data'
|
||||||
deliver_address:
|
benefactor_id:
|
||||||
$ref: '#/definitions/adminaddresshandler.Address'
|
type: integer
|
||||||
|
deliver_address_id:
|
||||||
|
type: integer
|
||||||
|
deliver_refer_date:
|
||||||
|
type: string
|
||||||
deliver_refer_time:
|
deliver_refer_time:
|
||||||
$ref: '#/definitions/adminrefertimeparam.Data'
|
$ref: '#/definitions/adminrefertimeparam.Data'
|
||||||
return_address:
|
deliver_refer_time_id:
|
||||||
$ref: '#/definitions/adminaddresshandler.Address'
|
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:
|
return_refer_time:
|
||||||
$ref: '#/definitions/adminrefertimeparam.Data'
|
$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
|
type: object
|
||||||
adminkindboxhandler.KindBoxAggregatedResponse:
|
adminkindboxhandler.KindBoxAggregatedResponse:
|
||||||
properties:
|
properties:
|
||||||
info:
|
amount:
|
||||||
$ref: '#/definitions/adminkindboxhandler.Info'
|
type: integer
|
||||||
kind_box:
|
benefactor:
|
||||||
$ref: '#/definitions/adminkindboxparam.Data'
|
$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
|
type: object
|
||||||
adminkindboxparam.AssignReceiverRequest:
|
adminkindboxparam.AssignReceiverRequest:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -299,36 +388,6 @@ definitions:
|
||||||
amount:
|
amount:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
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:
|
adminkindboxparam.KindBoxUpdateRequest:
|
||||||
properties:
|
properties:
|
||||||
amount:
|
amount:
|
||||||
|
|
@ -350,21 +409,80 @@ definitions:
|
||||||
example: 3
|
example: 3
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
adminkindboxreqhandler.Info:
|
adminkindboxreqhandler.KindBoxReqAggregatedListResponse:
|
||||||
properties:
|
properties:
|
||||||
benefactor:
|
benefactor:
|
||||||
$ref: '#/definitions/adminbenefactoreparam.Data'
|
$ref: '#/definitions/adminbenefactoreparam.Data'
|
||||||
deliver_address:
|
benefactor_id:
|
||||||
$ref: '#/definitions/adminaddresshandler.Address'
|
type: integer
|
||||||
deliver_refer_time:
|
count_accepted:
|
||||||
$ref: '#/definitions/adminrefertimeparam.Data'
|
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
|
type: object
|
||||||
adminkindboxreqhandler.KindBoxReqAggregatedResponse:
|
adminkindboxreqhandler.KindBoxReqAggregatedResponse:
|
||||||
properties:
|
properties:
|
||||||
info:
|
benefactor:
|
||||||
$ref: '#/definitions/adminkindboxreqhandler.Info'
|
$ref: '#/definitions/adminbenefactoreparam.Data'
|
||||||
kind_box_req:
|
benefactor_id:
|
||||||
$ref: '#/definitions/adminkindboxreqparam.Data'
|
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
|
type: object
|
||||||
adminkindboxreqparam.AssignSenderRequest:
|
adminkindboxreqparam.AssignSenderRequest:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -405,13 +523,6 @@ definitions:
|
||||||
status:
|
status:
|
||||||
$ref: '#/definitions/entity.KindBoxReqStatus'
|
$ref: '#/definitions/entity.KindBoxReqStatus'
|
||||||
type: object
|
type: object
|
||||||
adminkindboxreqparam.Info:
|
|
||||||
properties:
|
|
||||||
benefactors:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/adminbenefactoreparam.Data'
|
|
||||||
type: array
|
|
||||||
type: object
|
|
||||||
adminkindboxreqparam.KindBoxReqAcceptRequest:
|
adminkindboxreqparam.KindBoxReqAcceptRequest:
|
||||||
properties:
|
properties:
|
||||||
count_accepted:
|
count_accepted:
|
||||||
|
|
@ -457,21 +568,6 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
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:
|
adminkindboxreqparam.KindBoxReqRejectRequest:
|
||||||
properties:
|
properties:
|
||||||
description:
|
description:
|
||||||
|
|
@ -1568,7 +1664,9 @@ paths:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/adminkindboxparam.KindBoxGetAllResponse'
|
items:
|
||||||
|
$ref: '#/definitions/adminkindboxhandler.KindBoxesAggregatedResponse'
|
||||||
|
type: array
|
||||||
"400":
|
"400":
|
||||||
description: Bad request
|
description: Bad request
|
||||||
schema:
|
schema:
|
||||||
|
|
@ -1849,7 +1947,9 @@ paths:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/adminkindboxreqparam.KindBoxReqGetAllResponse'
|
items:
|
||||||
|
$ref: '#/definitions/adminkindboxreqhandler.KindBoxReqsAggregatedResponse'
|
||||||
|
type: array
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ package adminkindboxparam
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gocasts.ir/ebhomengo/niki/param"
|
"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 {
|
type KindBoxGetAllRequest struct {
|
||||||
|
|
@ -13,15 +11,8 @@ type KindBoxGetAllRequest struct {
|
||||||
Search param.SearchRequest
|
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 {
|
type KindBoxGetAllResponse struct {
|
||||||
Data []Data `json:"data"`
|
Data []Data `json:"data"`
|
||||||
Info Info `json:"info"`
|
|
||||||
Pagination param.PaginationResponse `json:"pagination"`
|
Pagination param.PaginationResponse `json:"pagination"`
|
||||||
FieldErrors map[string]string `json:"field_errors,omitempty"`
|
FieldErrors map[string]string `json:"field_errors,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ func (s Service) GetAggregatedByID(ctx context.Context, addressID uint) (adminad
|
||||||
ProvinceID: address.Address.ProvinceID,
|
ProvinceID: address.Address.ProvinceID,
|
||||||
BenefactorID: address.Address.BenefactorID,
|
BenefactorID: address.Address.BenefactorID,
|
||||||
},
|
},
|
||||||
Info: adminaddresshandler.Info{
|
|
||||||
Province: adminprovinceparam.Data{
|
Province: adminprovinceparam.Data{
|
||||||
ID: address.Province.ID,
|
ID: address.Province.ID,
|
||||||
Name: address.Province.Name,
|
Name: address.Province.Name,
|
||||||
|
|
@ -39,6 +38,5 @@ func (s Service) GetAggregatedByID(ctx context.Context, addressID uint) (adminad
|
||||||
Name: address.City.Name,
|
Name: address.City.Name,
|
||||||
ProvinceId: address.City.ProvinceID,
|
ProvinceId: address.City.ProvinceID,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,16 @@ import (
|
||||||
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
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"
|
const op = "adminbenefactoraggregatorservice.GetByIDs"
|
||||||
var data []param.Data
|
data := make(map[uint]param.Data)
|
||||||
|
|
||||||
benefactors, err := s.repo.GetByIDs(ctx, ids)
|
benefactors, err := s.repo.GetByIDs(ctx, ids)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, richerror.New(op).WithErr(err)
|
return nil, richerror.New(op).WithErr(err)
|
||||||
}
|
}
|
||||||
for _, benefactor := range benefactors {
|
for _, benefactor := range benefactors {
|
||||||
data = append(data, param.Data{
|
data[benefactor.ID] = param.Data{
|
||||||
ID: benefactor.ID,
|
ID: benefactor.ID,
|
||||||
FirstName: benefactor.FirstName,
|
FirstName: benefactor.FirstName,
|
||||||
LastName: benefactor.LastName,
|
LastName: benefactor.LastName,
|
||||||
|
|
@ -27,7 +27,7 @@ func (s Service) GetByIDs(ctx context.Context, ids []any) ([]param.Data, error)
|
||||||
Gender: benefactor.Gender,
|
Gender: benefactor.Gender,
|
||||||
BirthDate: response.GetNullDate(benefactor.BirthDate),
|
BirthDate: response.GetNullDate(benefactor.BirthDate),
|
||||||
Status: benefactor.Status,
|
Status: benefactor.Status,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,20 @@ import (
|
||||||
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
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"
|
const op = "adminrefertimeaggregatorservice.GetReferTimeByIDs"
|
||||||
var data []param.Data
|
data := make(map[uint]param.Data)
|
||||||
|
|
||||||
referTimes, err := s.repo.GetByIDs(ctx, ids)
|
referTimes, err := s.repo.GetByIDs(ctx, ids)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, richerror.New(op).WithErr(err)
|
return nil, richerror.New(op).WithErr(err)
|
||||||
}
|
}
|
||||||
for _, referTime := range referTimes {
|
for _, referTime := range referTimes {
|
||||||
data = append(data, param.Data{
|
data[referTime.ID] = param.Data{
|
||||||
ID: referTime.ID,
|
ID: referTime.ID,
|
||||||
Status: referTime.Status,
|
Status: referTime.Status,
|
||||||
Duration: referTime.Duration,
|
Duration: referTime.Duration,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue