diff --git a/delivery/http_server/admin/admin/login.go b/delivery/http_server/admin/admin/login.go index 40133f6..732d768 100644 --- a/delivery/http_server/admin/admin/login.go +++ b/delivery/http_server/admin/admin/login.go @@ -10,7 +10,7 @@ import ( // LoginByPhoneNumber godoc // @Summary Admin login by PhoneNumber -// @Tags Admin +// @Tags Admins // @Accept json // @Produce json // @Param Request body adminserviceparam.LoginWithPhoneNumberRequest true "Admin login request body" diff --git a/delivery/http_server/admin/admin/register.go b/delivery/http_server/admin/admin/register.go index 00791e2..5af9c83 100644 --- a/delivery/http_server/admin/admin/register.go +++ b/delivery/http_server/admin/admin/register.go @@ -10,7 +10,7 @@ import ( // Register godoc // @Summary Register an admin by super-admin -// @Tags Admin +// @Tags Admins // @Accept json // @Produce json // @Param Request body adminserviceparam.RegisterRequest true "Admin Register Request Body" diff --git a/delivery/http_server/admin/agent/get_all.go b/delivery/http_server/admin/agent/get_all.go index 1517121..5f49593 100644 --- a/delivery/http_server/admin/agent/get_all.go +++ b/delivery/http_server/admin/agent/get_all.go @@ -10,7 +10,7 @@ import ( // GetAllAgent godoc // @Summary Get all agents by admin -// @Tags Admin +// @Tags Admins // @Accept json // @Produce json // @Success 200 {object} adminagentparam.GetAllAgentResponse diff --git a/delivery/http_server/admin/kind_box/assign_receiver_agent.go b/delivery/http_server/admin/kind_box/assign_receiver_agent.go index 0a601c8..c631370 100644 --- a/delivery/http_server/admin/kind_box/assign_receiver_agent.go +++ b/delivery/http_server/admin/kind_box/assign_receiver_agent.go @@ -11,7 +11,7 @@ import ( // AssignReceiverAgent godoc // @Summary Admin assign receiver agent to kindbox -// @Tags KindBox +// @Tags Admins KindBoxes // @Accept json // @Produce json // @Param id path int true "KindBox ID" @@ -19,7 +19,7 @@ import ( // @Success 204 // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxes/assign-receiver-agent/{id} [patch]. +// @Router /admins/kindboxes/{id}/assign-receiver-agent [patch]. func (h Handler) AssignReceiverAgent(c echo.Context) error { var req param.AssignReceiverRequest diff --git a/delivery/http_server/admin/kind_box/enumerate.go b/delivery/http_server/admin/kind_box/enumerate.go index 495430c..b92c0dd 100644 --- a/delivery/http_server/admin/kind_box/enumerate.go +++ b/delivery/http_server/admin/kind_box/enumerate.go @@ -11,7 +11,7 @@ import ( // Enumerate godoc // @Summary Admin enumerate kindbox -// @Tags KindBox +// @Tags Admins KindBoxes // @Accept json // @Produce json // @Param id path int true "KindBox ID" @@ -23,7 +23,7 @@ import ( // @Failure 422 {object} httpmsg.ErrorResponse // @Failure 500 {string} "something went wrong" // @Security AuthBearerAdmin -// @Router /admin/kindboxes/{id}/enumerate [patch]. +// @Router /admins/kindboxes/{id}/enumerate [patch]. func (h Handler) Enumerate(c echo.Context) error { var req param.EnumerateKindBoxRequest diff --git a/delivery/http_server/admin/kind_box/get.go b/delivery/http_server/admin/kind_box/get.go index d22826e..4ffd874 100644 --- a/delivery/http_server/admin/kind_box/get.go +++ b/delivery/http_server/admin/kind_box/get.go @@ -11,14 +11,14 @@ import ( // Get godoc // @Summary Get a specific kind box by admin // @Description This endpoint retrieves a specific kind box by admin -// @Tags KindBox +// @Tags Admins KindBoxes // @Accept json // @Produce json // @Param id path int true "Kind box ID" // @Success 200 {object} param.KindBoxGetResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxes/{id} [get]. +// @Router /admins/kindboxes/{id} [get]. func (h Handler) Get(c echo.Context) error { var req param.KindBoxGetRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box/get_all.go b/delivery/http_server/admin/kind_box/get_all.go index f2e168d..72e932b 100644 --- a/delivery/http_server/admin/kind_box/get_all.go +++ b/delivery/http_server/admin/kind_box/get_all.go @@ -12,7 +12,7 @@ import ( // GetAll godoc // @Summary Get all KindBoxes by admin // @Description Retrieves a list of all KindBoxes with filtering, sorting, and pagination options -// @Tags KindBox +// @Tags Admins KindBoxes // @Accept json // @Produce json // @Param filter_id query int false "Filter by ID" @@ -39,7 +39,7 @@ import ( // @Success 200 {object} param.KindBoxGetAllResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxes [get]. +// @Router /admins/kindboxes [get]. func (h Handler) GetAll(c echo.Context) error { var req param.KindBoxGetAllRequest diff --git a/delivery/http_server/admin/kind_box/route.go b/delivery/http_server/admin/kind_box/route.go index 52267a0..146fc0a 100644 --- a/delivery/http_server/admin/kind_box/route.go +++ b/delivery/http_server/admin/kind_box/route.go @@ -7,12 +7,12 @@ import ( ) func (h Handler) SetRoutes(e *echo.Echo) { - r := e.Group("/admin/kindboxes") + r := e.Group("/admins/kindboxes") r.Use(middleware.Auth(h.authSvc)) r.GET("/:id", h.Get, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetPermission)) - r.PATCH("/assign-receiver-agent/:id", h.AssignReceiverAgent, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxAssignReceiverAgentPermission)) + r.PATCH("/:id/assign-receiver-agent", h.AssignReceiverAgent, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxAssignReceiverAgentPermission)) r.GET("", h.GetAll, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetAllPermission)) r.PATCH("/:id/enumerate", h.Enumerate, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxEnumeratePermission)) } diff --git a/delivery/http_server/admin/kind_box_req/accept.go b/delivery/http_server/admin/kind_box_req/accept.go index a1b2e7b..7f28009 100644 --- a/delivery/http_server/admin/kind_box_req/accept.go +++ b/delivery/http_server/admin/kind_box_req/accept.go @@ -13,7 +13,7 @@ import ( // Accept godoc // @Summary Accept kind box request by admin -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" @@ -21,7 +21,7 @@ import ( // @Success 200 {object} param.KindBoxReqAcceptResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/accept-kind-box-req/{id} [patch]. +// @Router /admins/kindboxreqs/{id}/accept-kind-box-req [patch]. func (h Handler) Accept(c echo.Context) error { var req param.KindBoxReqAcceptRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box_req/add.go b/delivery/http_server/admin/kind_box_req/add.go index a5d55f8..1b5b479 100644 --- a/delivery/http_server/admin/kind_box_req/add.go +++ b/delivery/http_server/admin/kind_box_req/add.go @@ -11,14 +11,14 @@ import ( // AddKindBoxReq godoc // @Summary Add a new kind box request for a benefactor by admin -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param Request body param.KindBoxReqAddRequest true "New kind box request details" // @Success 200 {object} param.KindBoxReqAddResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs [post]. +// @Router /admins/kindboxreqs [post]. func (h Handler) AddKindBoxReq(c echo.Context) error { req := param.KindBoxReqAddRequest{} if err := c.Bind(&req); err != nil { diff --git a/delivery/http_server/admin/kind_box_req/assign_sender_agent.go b/delivery/http_server/admin/kind_box_req/assign_sender_agent.go index 45162b3..fcdd04d 100644 --- a/delivery/http_server/admin/kind_box_req/assign_sender_agent.go +++ b/delivery/http_server/admin/kind_box_req/assign_sender_agent.go @@ -13,7 +13,7 @@ import ( // AssignSenderAgent godoc // @Summary Admin Assign Sender Agent to kindboxreq -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" @@ -21,7 +21,7 @@ import ( // @Success 200 {object} param.AssignSenderResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/assign-sender-agent/{id} [patch]. +// @Router /admins/kindboxreqs/{id}/assign-sender-agent [patch]. func (h Handler) AssignSenderAgent(c echo.Context) error { var req param.AssignSenderRequest diff --git a/delivery/http_server/admin/kind_box_req/deliver.go b/delivery/http_server/admin/kind_box_req/deliver.go index 9ddaeb7..edceb91 100644 --- a/delivery/http_server/admin/kind_box_req/deliver.go +++ b/delivery/http_server/admin/kind_box_req/deliver.go @@ -13,7 +13,7 @@ import ( // Deliver godoc // @Summary Admin deliver a kindboxreq -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" @@ -21,7 +21,7 @@ import ( // @Success 200 {object} param.DeliverKindBoxReqResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/deliver-kind-box-req/{id} [patch]. +// @Router /admins/kindboxreqs/{id}/deliver-kind-box-req [patch]. func (h Handler) Deliver(c echo.Context) error { var req param.DeliverKindBoxReqRequest diff --git a/delivery/http_server/admin/kind_box_req/get.go b/delivery/http_server/admin/kind_box_req/get.go index bb06f93..addad6a 100644 --- a/delivery/http_server/admin/kind_box_req/get.go +++ b/delivery/http_server/admin/kind_box_req/get.go @@ -10,7 +10,7 @@ import ( // Get godoc // @Summary Get a specific kind box req by ID -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" diff --git a/delivery/http_server/admin/kind_box_req/get_all.go b/delivery/http_server/admin/kind_box_req/get_all.go index 77d61e4..6e54538 100644 --- a/delivery/http_server/admin/kind_box_req/get_all.go +++ b/delivery/http_server/admin/kind_box_req/get_all.go @@ -12,7 +12,7 @@ import ( // GetAll godoc // @Summary Admin get all kindboxreq // @Description Retrieves a list of all KindBox requests with filtering, sorting, and pagination options -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param filter_id query int false "Filter by ID" diff --git a/delivery/http_server/admin/kind_box_req/get_all_delivery_awaiting.go b/delivery/http_server/admin/kind_box_req/get_all_delivery_awaiting.go index 2657d46..b7d4c1d 100644 --- a/delivery/http_server/admin/kind_box_req/get_all_delivery_awaiting.go +++ b/delivery/http_server/admin/kind_box_req/get_all_delivery_awaiting.go @@ -14,7 +14,7 @@ import ( // GetAllAwaitingDelivery godoc // @Summary Get all awaiting delivery KindBox requests // @Description Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param filter_id query int false "Filter by ID" @@ -32,7 +32,7 @@ import ( // @Success 200 {object} param.DeliveryAwaitingGetAllResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/awaiting-delivery [get]. +// @Router /admins/kindboxreqs/awaiting-delivery [get]. func (h Handler) GetAllAwaitingDelivery(c echo.Context) error { var req param.DeliveryAwaitingGetAllRequest diff --git a/delivery/http_server/admin/kind_box_req/get_delivery_awaiting.go b/delivery/http_server/admin/kind_box_req/get_delivery_awaiting.go index 6fe1006..337db68 100644 --- a/delivery/http_server/admin/kind_box_req/get_delivery_awaiting.go +++ b/delivery/http_server/admin/kind_box_req/get_delivery_awaiting.go @@ -11,14 +11,14 @@ import ( // GetAwaitingDelivery godoc // @Summary Get a kind box reqs that is awaiting delivery by agent -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" // @Success 200 {object} param.DeliveryAwaitingGetResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/awaiting-delivery/{id} [get]. +// @Router /admins/kindboxreqs/awaiting-delivery/{id} [get]. func (h Handler) GetAwaitingDelivery(c echo.Context) error { var req param.DeliveryAwaitingGetRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box_req/reject.go b/delivery/http_server/admin/kind_box_req/reject.go index 2444cb2..72af524 100644 --- a/delivery/http_server/admin/kind_box_req/reject.go +++ b/delivery/http_server/admin/kind_box_req/reject.go @@ -13,7 +13,7 @@ import ( // Reject godoc // @Summary Reject a kindboxreq by admin -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq id" @@ -21,7 +21,7 @@ import ( // @Success 200 {object} param.KindBoxReqRejectResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/reject-kind-box-req/{id} [patch]. +// @Router /admins/kindboxreqs/{id}/reject-kind-box-req [patch]. func (h Handler) Reject(c echo.Context) error { var req param.KindBoxReqRejectRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box_req/route.go b/delivery/http_server/admin/kind_box_req/route.go index 136fb06..9b0592a 100644 --- a/delivery/http_server/admin/kind_box_req/route.go +++ b/delivery/http_server/admin/kind_box_req/route.go @@ -11,10 +11,10 @@ func (h Handler) SetRoutes(e *echo.Echo) { r.Use(middleware.Auth(h.authSvc)) r.POST("", h.AddKindBoxReq, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAddPermission)) - r.PATCH("/accept-kind-box-req/:id", h.Accept, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAcceptPermission)) - r.PATCH("/reject-kind-box-req/:id", h.Reject, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqRejectPermission)) - r.PATCH("/deliver-kind-box-req/:id", h.Deliver, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqDeliverPermission)) - r.PATCH("/assign-sender-agent/:id", h.AssignSenderAgent, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAssignSenderAgentPermission)) + r.PATCH("/:id/accept-kind-box-req", h.Accept, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAcceptPermission)) + r.PATCH("/:id/reject-kind-box-req", h.Reject, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqRejectPermission)) + r.PATCH("/:id/deliver-kind-box-req", h.Deliver, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqDeliverPermission)) + r.PATCH("/:id/assign-sender-agent", h.AssignSenderAgent, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAssignSenderAgentPermission)) r.GET("", h.GetAll, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAllPermission)) r.GET("/awaiting-delivery/:id", h.GetAwaitingDelivery, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAwaitingDeliveryPermission)) r.GET("/awaiting-delivery", h.GetAllAwaitingDelivery, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAwaitingDeliveryPermission)) diff --git a/delivery/http_server/admin/kind_box_req/update.go b/delivery/http_server/admin/kind_box_req/update.go index d63aaf0..2f1e6ff 100644 --- a/delivery/http_server/admin/kind_box_req/update.go +++ b/delivery/http_server/admin/kind_box_req/update.go @@ -10,7 +10,7 @@ import ( // Update godoc // @Summary Update kind box request by admin -// @Tags KindBoxReq +// @Tags Admins KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" @@ -18,7 +18,7 @@ import ( // @Success 204 // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/{id} [put]. +// @Router /admins/kindboxreqs/{id} [put]. func (h Handler) Update(c echo.Context) error { var req param.KindBoxReqUpdateRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/agent/kind_box/get.go b/delivery/http_server/agent/kind_box/get.go index ad075f5..599fa5b 100644 --- a/delivery/http_server/agent/kind_box/get.go +++ b/delivery/http_server/agent/kind_box/get.go @@ -11,7 +11,7 @@ import ( // Get godoc // @Summary Get a kind box that is awaiting return by agent -// @Tags KindBox +// @Tags Agents KindBoxes // @Accept json // @Produce json // @Param id path int true "KindBox ID" diff --git a/delivery/http_server/agent/kind_box/get_all.go b/delivery/http_server/agent/kind_box/get_all.go index b18aeed..7e29b5e 100644 --- a/delivery/http_server/agent/kind_box/get_all.go +++ b/delivery/http_server/agent/kind_box/get_all.go @@ -14,7 +14,7 @@ import ( // GetAll godoc // @Summary Get all awaiting return KindBoxes by agent // @Description Retrieves a list of all awaiting return KindBoxes for agent with filtering, sorting, and pagination options -// @Tags KindBox +// @Tags Agents KindBoxes // @Accept json // @Produce json // @Param filter_id query int false "Filter by ID" diff --git a/delivery/http_server/agent/kind_box/return.go b/delivery/http_server/agent/kind_box/return.go index 0931a15..950b0f2 100644 --- a/delivery/http_server/agent/kind_box/return.go +++ b/delivery/http_server/agent/kind_box/return.go @@ -11,7 +11,7 @@ import ( // Return godoc // @Summary Return KindBox from benefactor by agent -// @Tags KindBox +// @Tags Agents KindBoxes // @Accept json // @Produce json // @Param id path int true "KindBox ID" @@ -23,7 +23,7 @@ import ( // @Failure 422 {object} httpmsg.ErrorResponse // @Failure 500 {string} "something went wrong" // @Security AuthBearerAdmin -// @Router /agents/kindboxes/return/{id} [patch]. +// @Router /agents/kindboxes/{id}/return [patch]. func (h Handler) Return(c echo.Context) error { var req param.ReturnKindBoxRequest if err := c.Bind(&req); err != nil { diff --git a/delivery/http_server/agent/kind_box/route.go b/delivery/http_server/agent/kind_box/route.go index 0264350..1e68782 100644 --- a/delivery/http_server/agent/kind_box/route.go +++ b/delivery/http_server/agent/kind_box/route.go @@ -13,5 +13,5 @@ func (h Handler) SetRoutes(e *echo.Echo) { r.GET("/:id", h.Get, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetAwaitingReturnPermission)) r.GET("", h.GetAll, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetAwaitingReturnPermission)) - r.PATCH("/return/:id", h.Return, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReturnPermission)) + r.PATCH("/:id/return", h.Return, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReturnPermission)) } diff --git a/delivery/http_server/benefactor/address/add_address.go b/delivery/http_server/benefactor/address/add_address.go index 64b47d0..d00251c 100644 --- a/delivery/http_server/benefactor/address/add_address.go +++ b/delivery/http_server/benefactor/address/add_address.go @@ -12,14 +12,14 @@ import ( // AddAddress godoc // @Summary Add a new address for a benefactor // @Description This endpoint allows an authenticated benefactor to add a new address to their account. -// @Tags Address +// @Tags Benefactors Addresses // @Accept json // @Produce json // @Param Request body param.BenefactorAddAddressRequest true "New address details" // @Success 201 {object} param.BenefactorAddAddressResponse // @Failure 400 {string} "Bad request" -// @Security AuthBearerBenefactor -// @Router /address/ [post]. +// @Security AuthBearerBenefactor +// @Router /benefactors/addresses [post]. func (h Handler) AddAddress(c echo.Context) error { req := param.BenefactorAddAddressRequest{} if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/benefactor/address/delete.go b/delivery/http_server/benefactor/address/delete.go index c7e25b4..91ef4ff 100644 --- a/delivery/http_server/benefactor/address/delete.go +++ b/delivery/http_server/benefactor/address/delete.go @@ -12,12 +12,12 @@ import ( // DeleteAddress godoc // @Summary Delete address by benefactor // @Description This endpoint is used to delete an address by benefactor -// @Tags Address +// @Tags Benefactors Addresses // @Param id path int true "Address ID" // @Success 204 // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/{id} [delete]. +// @Router /benefactors/addresses/{id} [delete]. func (h Handler) DeleteAddress(c echo.Context) error { var req param.DeleteAddressRequest diff --git a/delivery/http_server/benefactor/address/get.go b/delivery/http_server/benefactor/address/get.go index a1eefcb..12a05ca 100644 --- a/delivery/http_server/benefactor/address/get.go +++ b/delivery/http_server/benefactor/address/get.go @@ -11,14 +11,14 @@ import ( // GetAddress godoc // @Summary Get a benefactor address -// @Tags Address +// @Tags Benefactors Addresses // @Accept json // @Produce json // @Param id path int true "Address ID" // @Success 200 {object} param.GetAddressResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/{id} [get]. +// @Router /benefactors/addresses/{id} [get]. func (h Handler) GetAddress(c echo.Context) error { var req param.GetAddressRequest if bErr := echo.PathParamsBinder(c).Uint("id", &req.AddressID).BindError(); bErr != nil { diff --git a/delivery/http_server/benefactor/address/get_all.go b/delivery/http_server/benefactor/address/get_all.go index a3d5d2e..9217e84 100644 --- a/delivery/http_server/benefactor/address/get_all.go +++ b/delivery/http_server/benefactor/address/get_all.go @@ -11,13 +11,13 @@ import ( // GetAddresses godoc // @Summary Get all benefactor addresses -// @Tags Address +// @Tags Benefactors Addresses // @Accept json // @Produce json // @Success 200 {object} param.GetAllAddressesResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/ [get]. +// @Router /benefactors/addresses [get]. func (h Handler) GetAddresses(c echo.Context) error { var req param.GetAllAddressesRequest diff --git a/delivery/http_server/benefactor/address/get_all_cities.go b/delivery/http_server/benefactor/address/get_all_cities.go index 69257f9..7c4fa63 100644 --- a/delivery/http_server/benefactor/address/get_all_cities.go +++ b/delivery/http_server/benefactor/address/get_all_cities.go @@ -10,12 +10,12 @@ import ( // GetAllCities godoc // @Summary Get all cities -// @Tags Address +// @Tags Benefactors Addresses // @Accept json // @Produce json // @Success 200 {object} addressparam.GetAllCitiesResponse // @Failure 400 {string} "Bad request" -// @Router /address/cities [get]. +// @Router /benefactors/addresses/cities [get]. func (h Handler) GetAllCities(c echo.Context) error { var req addressparam.GetAllCitiesRequest diff --git a/delivery/http_server/benefactor/address/get_all_provinces.go b/delivery/http_server/benefactor/address/get_all_provinces.go index 98bc6cc..12100ec 100644 --- a/delivery/http_server/benefactor/address/get_all_provinces.go +++ b/delivery/http_server/benefactor/address/get_all_provinces.go @@ -10,12 +10,12 @@ import ( // GetAllProvinces godoc // @Summary Get all provinces -// @Tags Address +// @Tags Benefactors Addresses // @Accept json // @Produce json // @Success 200 {object} addressparam.GetAllProvincesResponse // @Failure 400 {string} "Bad request" -// @Router /address/provinces [get]. +// @Router /benefactors/addresses/provinces [get]. func (h Handler) GetAllProvinces(c echo.Context) error { var req addressparam.GetAllProvincesRequest diff --git a/delivery/http_server/benefactor/address/route.go b/delivery/http_server/benefactor/address/route.go index c56d49d..8a67b59 100644 --- a/delivery/http_server/benefactor/address/route.go +++ b/delivery/http_server/benefactor/address/route.go @@ -7,18 +7,18 @@ import ( ) func (h Handler) SetRoutes(e *echo.Echo) { - r := e.Group("/address") + r := e.Group("/benefactors/addresses") r.GET("/provinces", h.GetAllProvinces) r.GET("/cities", h.GetAllCities) - r.POST("/", h.AddAddress, middleware.Auth(h.authSvc), + r.POST("", h.AddAddress, middleware.Auth(h.authSvc), middleware.BenefactorAuthorization(entity.UserBenefactorRole)) r.GET("/:id", h.GetAddress, middleware.Auth(h.authSvc), middleware.BenefactorAuthorization(entity.UserBenefactorRole)) - r.GET("/", h.GetAddresses, middleware.Auth(h.authSvc), + r.GET("", h.GetAddresses, middleware.Auth(h.authSvc), middleware.BenefactorAuthorization(entity.UserBenefactorRole)) r.DELETE("/:id", h.DeleteAddress, middleware.Auth(h.authSvc), middleware.BenefactorAuthorization(entity.UserBenefactorRole)) - r.PATCH("/:id", h.UpdateAddress, middleware.Auth(h.authSvc), + r.PUT("/:id", h.UpdateAddress, middleware.Auth(h.authSvc), middleware.BenefactorAuthorization(entity.UserBenefactorRole)) } diff --git a/delivery/http_server/benefactor/address/update.go b/delivery/http_server/benefactor/address/update.go index a785f11..a4e55d9 100644 --- a/delivery/http_server/benefactor/address/update.go +++ b/delivery/http_server/benefactor/address/update.go @@ -10,8 +10,8 @@ import ( ) // UpdateAddress godoc -// @Summary Edit benefactor address -// @Tags Address +// @Summary Update benefactor address +// @Tags Benefactors Addresses // @Accept json // @Produce json // @Param id path int true "Address ID" @@ -19,7 +19,7 @@ import ( // @Success 204 // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/{id} [patch]. +// @Router /benefactors/addresses/{id} [put]. func (h Handler) UpdateAddress(c echo.Context) error { var req param.UpdateAddressRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/benefactor/benefactor/login_register.go b/delivery/http_server/benefactor/benefactor/login_register.go index 8c8220a..4eb43df 100644 --- a/delivery/http_server/benefactor/benefactor/login_register.go +++ b/delivery/http_server/benefactor/benefactor/login_register.go @@ -11,13 +11,13 @@ import ( // loginOrRegister godoc // @Summary Login or register a benefactor // @Description This endpoint is used to authenticate an existing benefactor account or register a new one. -// @Tags Benefactor +// @Tags Benefactors // @Accept json // @Produce json // @Param Request body benefactoreparam.LoginOrRegisterRequest true "Login or register request details" // @Success 200 {object} benefactoreparam.LoginOrRegisterResponse // @Failure 400 {string} "Bad request" -// @Router /benefactor/login-register [post]. +// @Router /benefactors/login-register [post]. func (h Handler) loginOrRegister(c echo.Context) error { var req benefactoreparam.LoginOrRegisterRequest diff --git a/delivery/http_server/benefactor/benefactor/route.go b/delivery/http_server/benefactor/benefactor/route.go index 0f4fca0..d8c8baa 100644 --- a/delivery/http_server/benefactor/benefactor/route.go +++ b/delivery/http_server/benefactor/benefactor/route.go @@ -5,7 +5,7 @@ import ( ) func (h Handler) SetRoutes(e *echo.Echo) { - r := e.Group("/benefactor") + r := e.Group("/benefactors") r.POST("/send-otp", h.SendOtp) r.POST("/login-register", h.loginOrRegister) diff --git a/delivery/http_server/benefactor/benefactor/send_otp.go b/delivery/http_server/benefactor/benefactor/send_otp.go index d6da641..fed37c2 100644 --- a/delivery/http_server/benefactor/benefactor/send_otp.go +++ b/delivery/http_server/benefactor/benefactor/send_otp.go @@ -11,13 +11,13 @@ import ( // SendOtp godoc // @Summary Send OTP to benefactor // @Description This endpoint sends an OTP to the benefactor's phone number for verification purposes. -// @Tags Benefactor +// @Tags Benefactors // @Accept json // @Produce json // @Param Request body benefactoreparam.SendOtpRequest true "Send OTP request details" // @Success 200 {object} benefactoreparam.SendOtpResponse // @Failure 400 {string} "Bad request" -// @Router /benefactor/send-otp [post]. +// @Router /benefactors/send-otp [post]. func (h Handler) SendOtp(c echo.Context) error { var req benefactoreparam.SendOtpRequest diff --git a/delivery/http_server/benefactor/kind_box/get.go b/delivery/http_server/benefactor/kind_box/get.go index 424defe..161121c 100644 --- a/delivery/http_server/benefactor/kind_box/get.go +++ b/delivery/http_server/benefactor/kind_box/get.go @@ -11,14 +11,14 @@ import ( // Get godoc // @Summary Get a specific kind box for a benefactor // @Description This endpoint retrieves a specific kind box associated with an authenticated benefactor. -// @Tags KindBox +// @Tags Benefactors KindBoxes // @Accept json // @Produce json // @Param id path int true "Kind box ID" // @Success 200 {object} param.KindBoxGetResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxes/{id} [get]. +// @Router /benefactors/kindboxes/{id} [get]. func (h Handler) Get(c echo.Context) error { var req param.KindBoxGetRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/benefactor/kind_box/get_all.go b/delivery/http_server/benefactor/kind_box/get_all.go index 507ec91..cd99fa8 100644 --- a/delivery/http_server/benefactor/kind_box/get_all.go +++ b/delivery/http_server/benefactor/kind_box/get_all.go @@ -13,7 +13,7 @@ import ( // GetAll godoc // @Summary Get all KindBoxes by benefactor // @Description Retrieves a list of all KindBoxes with filtering, sorting, and pagination options -// @Tags KindBox +// @Tags Benefactors KindBoxes // @Accept json // @Produce json // @Param filter_id query int false "Filter by ID" @@ -40,7 +40,7 @@ import ( // @Success 200 {object} param.KindBoxGetAllResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxes [get]. +// @Router /benefactors/kindboxes [get]. func (h Handler) GetAll(c echo.Context) error { var req param.KindBoxGetAllRequest diff --git a/delivery/http_server/benefactor/kind_box/register_emptying_request.go b/delivery/http_server/benefactor/kind_box/register_emptying_request.go index 7ba3867..7217f27 100644 --- a/delivery/http_server/benefactor/kind_box/register_emptying_request.go +++ b/delivery/http_server/benefactor/kind_box/register_emptying_request.go @@ -12,7 +12,7 @@ import ( // RegisterEmptyingRequest godoc // @Summary Register a new emptying request for a kind box by benefactor -// @Tags Benefactor +// @Tags Benefactors KindBoxes // @Accept json // @Produce json // @Param id path int true "KindBox ID" @@ -20,7 +20,7 @@ import ( // @Success 204 {string} "No content" // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxes/{id}/emptying-requests [patch]. +// @Router /benefactors/kindboxes/{id}/emptying-requests [patch]. func (h Handler) RegisterEmptyingRequest(c echo.Context) error { var req param.KindBoxRegisterEmptyingRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/benefactor/kind_box/route.go b/delivery/http_server/benefactor/kind_box/route.go index 4e3f38d..696afa6 100644 --- a/delivery/http_server/benefactor/kind_box/route.go +++ b/delivery/http_server/benefactor/kind_box/route.go @@ -7,7 +7,7 @@ import ( ) func (h Handler) SetRoutes(e *echo.Echo) { - r := e.Group("/benefactor/kindboxes") + r := e.Group("/benefactors/kindboxes") r.Use( middleware.Auth(h.authSvc), diff --git a/delivery/http_server/benefactor/kind_box_req/add.go b/delivery/http_server/benefactor/kind_box_req/add.go index 7066139..f575d2e 100644 --- a/delivery/http_server/benefactor/kind_box_req/add.go +++ b/delivery/http_server/benefactor/kind_box_req/add.go @@ -13,14 +13,14 @@ import ( // Add godoc // @Summary Add a new kind box request for a benefactor -// @Tags KindBoxReq +// @Tags Benefactors KindBoxReqs // @Accept json // @Produce json // @Param Request body param.KindBoxReqAddRequest true "New kind box request details" // @Success 200 {object} param.KindBoxReqAddResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/ [post]. +// @Router /benefactors/kindboxreqs [post]. func (h Handler) Add(c echo.Context) error { req := param.KindBoxReqAddRequest{} if err := c.Bind(&req); err != nil { diff --git a/delivery/http_server/benefactor/kind_box_req/delete.go b/delivery/http_server/benefactor/kind_box_req/delete.go index c062ebb..de7b8ca 100644 --- a/delivery/http_server/benefactor/kind_box_req/delete.go +++ b/delivery/http_server/benefactor/kind_box_req/delete.go @@ -9,17 +9,17 @@ import ( "github.com/labstack/echo/v4" ) -// delete godoc -// @Summary delete kindboxreq by benefactor +// Delete godoc +// @Summary Delete kindboxreq by benefactor // @Description This endpoint is used to delete benefactor's kindboxreq at pending status -// @Tags KindBoxReq +// @Tags Benefactors KindBoxReqs // @Accept json // @Produce json // @Param id path int true "Kind box request ID" // @Success 200 {object} param.KindBoxReqDeleteResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/{id} [delete]. +// @Router /benefactors/kindboxreqs/{id} [delete]. func (h Handler) Delete(c echo.Context) error { req := param.KindBoxReqDeleteRequest{} if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { diff --git a/delivery/http_server/benefactor/kind_box_req/get.go b/delivery/http_server/benefactor/kind_box_req/get.go index 4fadde1..245cc8b 100644 --- a/delivery/http_server/benefactor/kind_box_req/get.go +++ b/delivery/http_server/benefactor/kind_box_req/get.go @@ -11,14 +11,14 @@ import ( // Get godoc // @Summary Get a kind box request for a benefactor -// @Tags KindBoxReq +// @Tags Benefactors KindBoxReqs // @Accept json // @Produce json // @Param id path int true "Kind box request ID" // @Success 200 {object} param.KindBoxReqGetResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/{id} [get]. +// @Router /benefactors/kindboxreqs/{id} [get]. func (h Handler) Get(c echo.Context) error { var req param.KindBoxReqGetRequest if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { diff --git a/delivery/http_server/benefactor/kind_box_req/get_all.go b/delivery/http_server/benefactor/kind_box_req/get_all.go index 107881c..71f5148 100644 --- a/delivery/http_server/benefactor/kind_box_req/get_all.go +++ b/delivery/http_server/benefactor/kind_box_req/get_all.go @@ -13,7 +13,7 @@ import ( // GetAll godoc // @Summary Get all KindBox requests // @Description Retrieves a list of all KindBox requests with filtering, sorting, and pagination options -// @Tags KindBoxReq +// @Tags Benefactors KindBoxReqs // @Accept json // @Produce json // @Param filter_id query int false "Filter by ID" @@ -32,7 +32,7 @@ import ( // @Success 200 {object} param.GetAllResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/ [get]. +// @Router /benefactors/kindboxreqs [get]. func (h Handler) GetAll(c echo.Context) error { var req param.GetAllRequest diff --git a/delivery/http_server/benefactor/kind_box_req/route.go b/delivery/http_server/benefactor/kind_box_req/route.go index 338fbc9..77b101a 100644 --- a/delivery/http_server/benefactor/kind_box_req/route.go +++ b/delivery/http_server/benefactor/kind_box_req/route.go @@ -7,16 +7,16 @@ import ( ) func (h Handler) SetRoutes(e *echo.Echo) { - r := e.Group("/benefactor/kindboxreqs") + r := e.Group("/benefactors/kindboxreqs") r.Use( middleware.Auth(h.authSvc), middleware.BenefactorAuthorization(entity.UserBenefactorRole), ) - r.POST("/", h.Add) + r.POST("", h.Add) r.GET("/:id", h.Get) r.DELETE("/:id", h.Delete) - r.GET("/", h.GetAll) + r.GET("", h.GetAll) r.PUT("/:id", h.Update) } diff --git a/delivery/http_server/benefactor/kind_box_req/update.go b/delivery/http_server/benefactor/kind_box_req/update.go index 20c6281..b3b497c 100644 --- a/delivery/http_server/benefactor/kind_box_req/update.go +++ b/delivery/http_server/benefactor/kind_box_req/update.go @@ -11,7 +11,7 @@ import ( // Update godoc // @Summary Update kind box request by benefactor -// @Tags KindBoxReq +// @Tags Benefactors KindBoxReqs // @Accept json // @Produce json // @Param id path int true "KindBoxReq ID" @@ -23,7 +23,7 @@ import ( // @Failure 422 {object} httpmsg.ErrorResponse // @Failure 500 {string} "something went wrong" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/{id} [put]. +// @Router /benefactors/kindboxreqs/{id} [put]. func (h Handler) Update(c echo.Context) error { var req param.KindBoxReqUpdateRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/docs/docs.go b/docs/docs.go index b0fa746..0af1ef6 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -15,11 +15,11 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { - "/address/": { + "/admins/agents": { "get": { "security": [ { - "AuthBearerBenefactor": [] + "AuthBearerAdmin": [] } ], "consumes": [ @@ -29,57 +29,14 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Address" + "Admins" ], - "summary": "Get all benefactor addresses", + "summary": "Get all agents by admin", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/addressparam.GetAllAddressesResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "description": "This endpoint allows an authenticated benefactor to add a new address to their account.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Add a new address for a benefactor", - "parameters": [ - { - "description": "New address details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addressparam.BenefactorAddAddressRequest" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/addressparam.BenefactorAddAddressResponse" + "$ref": "#/definitions/adminagentparam.GetAllAgentResponse" } }, "400": { @@ -91,183 +48,7 @@ const docTemplate = `{ } } }, - "/address/cities": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Get all cities", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/addressparam.GetAllCitiesResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/address/provinces": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Get all provinces", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/addressparam.GetAllProvincesResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/address/{id}": { - "get": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Get a benefactor address", - "parameters": [ - { - "type": "integer", - "description": "Address ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/addressparam.GetAddressResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - }, - "delete": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "description": "This endpoint is used to delete an address by benefactor", - "tags": [ - "Address" - ], - "summary": "Delete address by benefactor", - "parameters": [ - { - "type": "integer", - "description": "Address ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - }, - "patch": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Edit benefactor address", - "parameters": [ - { - "type": "integer", - "description": "Address ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Edit address details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addressparam.UpdateAddressRequest" - } - } - ], - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxes": { + "/admins/kindboxes": { "get": { "security": [ { @@ -282,7 +63,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Admins KindBoxes" ], "summary": "Get all KindBoxes by admin", "parameters": [ @@ -468,7 +249,50 @@ const docTemplate = `{ } } }, - "/admin/kindboxes/assign-receiver-agent/{id}": { + "/admins/kindboxes/{id}": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "description": "This endpoint retrieves a specific kind box by admin", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxes" + ], + "summary": "Get a specific kind box by admin", + "parameters": [ + { + "type": "integer", + "description": "Kind box ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxparam.KindBoxGetResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxes/{id}/assign-receiver-agent": { "patch": { "security": [ { @@ -482,7 +306,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Admins KindBoxes" ], "summary": "Admin assign receiver agent to kindbox", "parameters": [ @@ -516,50 +340,7 @@ const docTemplate = `{ } } }, - "/admin/kindboxes/{id}": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "description": "This endpoint retrieves a specific kind box by admin", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBox" - ], - "summary": "Get a specific kind box by admin", - "parameters": [ - { - "type": "integer", - "description": "Kind box ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxparam.KindBoxGetResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxes/{id}/enumerate": { + "/admins/kindboxes/{id}/enumerate": { "patch": { "security": [ { @@ -573,7 +354,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Admins KindBoxes" ], "summary": "Admin enumerate kindbox", "parameters": [ @@ -631,506 +412,6 @@ const docTemplate = `{ } } }, - "/admin/kindboxreqs": { - "post": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Add a new kind box request for a benefactor by admin", - "parameters": [ - { - "description": "New kind box request details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/accept-kind-box-req/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Accept kind box request by admin", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Accept KindBoxReq Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/assign-sender-agent/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Admin Assign Sender Agent to kindboxreq", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Assign Sender Agent Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.AssignSenderRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.AssignSenderResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/awaiting-delivery": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "description": "Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Get all awaiting delivery KindBox requests", - "parameters": [ - { - "type": "integer", - "description": "Filter by ID", - "name": "filter_id", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by benefactor ID", - "name": "filter_benefactor_id", - "in": "query" - }, - { - "enum": [ - "on-table", - "cylindrical", - "stand-up" - ], - "type": "string", - "format": "enum", - "description": "Filter by KindBox type", - "name": "filter_kind_box_type", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by count requested", - "name": "filter_count_requested", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by count accepted", - "name": "filter_count_accepted", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by deliver refer time ID", - "name": "filter_deliver_refer_time_id", - "in": "query" - }, - { - "type": "string", - "format": "date", - "description": "Filter by deliver refer date", - "name": "filter_deliver_refer_date", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by deliver address ID", - "name": "filter_deliver_address_id", - "in": "query" - }, - { - "type": "integer", - "description": "Page number", - "name": "page_number", - "in": "query" - }, - { - "type": "integer", - "description": "Page size", - "name": "page_size", - "in": "query" - }, - { - "enum": [ - "id", - "benefactor_id", - "kind_box_type", - "count_requested", - "count_accepted", - "deliver_refer_time_id", - "deliver_refer_date", - "deliver_address_id" - ], - "type": "string", - "description": "Sort by field", - "name": "sort_field", - "in": "query" - }, - { - "enum": [ - "asc", - "desc" - ], - "type": "string", - "description": "Sort order", - "name": "sort_direction", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetAllResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/awaiting-delivery/{id}": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Get a kind box reqs that is awaiting delivery by agent", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/deliver-kind-box-req/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Admin deliver a kindboxreq", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "KindBoxReq deliver request details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/reject-kind-box-req/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Reject a kindboxreq by admin", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq id", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "KindBoxReq Reject Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/{id}": { - "put": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Update kind box request by admin", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Update KindBoxReq Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqUpdateRequest" - } - } - ], - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admins/agents": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Admin" - ], - "summary": "Get all agents by admin", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminagentparam.GetAllAgentResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, "/admins/kindboxreqs": { "get": { "security": [ @@ -1146,7 +427,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Admins KindBoxReqs" ], "summary": "Admin get all kindboxreq", "parameters": [ @@ -1312,6 +593,219 @@ const docTemplate = `{ } } } + }, + "post": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Add a new kind box request for a benefactor by admin", + "parameters": [ + { + "description": "New kind box request details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/awaiting-delivery": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "description": "Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Get all awaiting delivery KindBox requests", + "parameters": [ + { + "type": "integer", + "description": "Filter by ID", + "name": "filter_id", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by benefactor ID", + "name": "filter_benefactor_id", + "in": "query" + }, + { + "enum": [ + "on-table", + "cylindrical", + "stand-up" + ], + "type": "string", + "format": "enum", + "description": "Filter by KindBox type", + "name": "filter_kind_box_type", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by count requested", + "name": "filter_count_requested", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by count accepted", + "name": "filter_count_accepted", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by deliver refer time ID", + "name": "filter_deliver_refer_time_id", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "Filter by deliver refer date", + "name": "filter_deliver_refer_date", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by deliver address ID", + "name": "filter_deliver_address_id", + "in": "query" + }, + { + "type": "integer", + "description": "Page number", + "name": "page_number", + "in": "query" + }, + { + "type": "integer", + "description": "Page size", + "name": "page_size", + "in": "query" + }, + { + "enum": [ + "id", + "benefactor_id", + "kind_box_type", + "count_requested", + "count_accepted", + "deliver_refer_time_id", + "deliver_refer_date", + "deliver_address_id" + ], + "type": "string", + "description": "Sort by field", + "name": "sort_field", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "Sort order", + "name": "sort_direction", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetAllResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/awaiting-delivery/{id}": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Get a kind box reqs that is awaiting delivery by agent", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } } }, "/admins/kindboxreqs/{id}": { @@ -1328,7 +822,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Admins KindBoxReqs" ], "summary": "Get a specific kind box req by ID", "parameters": [ @@ -1378,6 +872,256 @@ const docTemplate = `{ } } } + }, + "put": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Update kind box request by admin", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Update KindBoxReq Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqUpdateRequest" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/accept-kind-box-req": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Accept kind box request by admin", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Accept KindBoxReq Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/assign-sender-agent": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Admin Assign Sender Agent to kindboxreq", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Assign Sender Agent Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.AssignSenderRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.AssignSenderResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/deliver-kind-box-req": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Admin deliver a kindboxreq", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "KindBoxReq deliver request details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/reject-kind-box-req": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Reject a kindboxreq by admin", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq id", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "KindBoxReq Reject Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } } }, "/admins/login-by-phone": { @@ -1389,7 +1133,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Admin" + "Admins" ], "summary": "Admin login by\tPhoneNumber", "parameters": [ @@ -1433,7 +1177,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Admin" + "Admins" ], "summary": "Register an admin by super-admin", "parameters": [ @@ -1478,7 +1222,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Agents KindBoxes" ], "summary": "Get all awaiting return KindBoxes by agent", "parameters": [ @@ -1609,7 +1353,73 @@ const docTemplate = `{ } } }, - "/agents/kindboxes/return/{id}": { + "/agents/kindboxes/{id}": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Agents KindBoxes" + ], + "summary": "Get a kind box that is awaiting return by agent", + "parameters": [ + { + "type": "integer", + "description": "KindBox ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/agentkindboxparam.GetKindBoxResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "string" + } + }, + "401": { + "description": "invalid or expired jwt", + "schema": { + "type": "string" + } + }, + "403": { + "description": "user not allowed", + "schema": { + "type": "string" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/httpmsg.ErrorResponse" + } + }, + "500": { + "description": "something went wrong", + "schema": { + "type": "string" + } + } + } + } + }, + "/agents/kindboxes/{id}/return": { "patch": { "security": [ { @@ -1623,7 +1433,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Agents KindBoxes" ], "summary": "Return KindBox from benefactor by agent", "parameters": [ @@ -1681,11 +1491,11 @@ const docTemplate = `{ } } }, - "/agents/kindboxes/{id}": { + "/benefactors/addresses": { "get": { "security": [ { - "AuthBearerAdmin": [] + "AuthBearerBenefactor": [] } ], "consumes": [ @@ -1695,13 +1505,145 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Benefactors Addresses" ], - "summary": "Get a kind box that is awaiting return by agent", + "summary": "Get all benefactor addresses", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/addressparam.GetAllAddressesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "description": "This endpoint allows an authenticated benefactor to add a new address to their account.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Add a new address for a benefactor", + "parameters": [ + { + "description": "New address details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/addressparam.BenefactorAddAddressRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/addressparam.BenefactorAddAddressResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/benefactors/addresses/cities": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Get all cities", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/addressparam.GetAllCitiesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/benefactors/addresses/provinces": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Get all provinces", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/addressparam.GetAllProvincesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/benefactors/addresses/{id}": { + "get": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Get a benefactor address", "parameters": [ { "type": "integer", - "description": "KindBox ID", + "description": "Address ID", "name": "id", "in": "path", "required": true @@ -1711,35 +1653,89 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/agentkindboxparam.GetKindBoxResponse" + "$ref": "#/definitions/addressparam.GetAddressResponse" } }, "400": { - "description": "Bad Request", + "description": "Bad request", "schema": { "type": "string" } + } + } + }, + "put": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Update benefactor address", + "parameters": [ + { + "type": "integer", + "description": "Address ID", + "name": "id", + "in": "path", + "required": true }, - "401": { - "description": "invalid or expired jwt", + { + "description": "Edit address details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/addressparam.UpdateAddressRequest" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad request", "schema": { "type": "string" } + } + } + }, + "delete": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "description": "This endpoint is used to delete an address by benefactor", + "tags": [ + "Benefactors Addresses" + ], + "summary": "Delete address by benefactor", + "parameters": [ + { + "type": "integer", + "description": "Address ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" }, - "403": { - "description": "user not allowed", - "schema": { - "type": "string" - } - }, - "422": { - "description": "Unprocessable Entity", - "schema": { - "$ref": "#/definitions/httpmsg.ErrorResponse" - } - }, - "500": { - "description": "something went wrong", + "400": { + "description": "Bad request", "schema": { "type": "string" } @@ -1747,7 +1743,7 @@ const docTemplate = `{ } } }, - "/benefactor/kindboxes": { + "/benefactors/kindboxes": { "get": { "security": [ { @@ -1762,7 +1758,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Benefactors KindBoxes" ], "summary": "Get all KindBoxes by benefactor", "parameters": [ @@ -1948,7 +1944,7 @@ const docTemplate = `{ } } }, - "/benefactor/kindboxes/{id}": { + "/benefactors/kindboxes/{id}": { "get": { "security": [ { @@ -1963,7 +1959,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBox" + "Benefactors KindBoxes" ], "summary": "Get a specific kind box for a benefactor", "parameters": [ @@ -1991,7 +1987,7 @@ const docTemplate = `{ } } }, - "/benefactor/kindboxes/{id}/emptying-requests": { + "/benefactors/kindboxes/{id}/emptying-requests": { "patch": { "security": [ { @@ -2005,7 +2001,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Benefactor" + "Benefactors KindBoxes" ], "summary": "Register a new emptying request for a kind box by benefactor", "parameters": [ @@ -2042,7 +2038,7 @@ const docTemplate = `{ } } }, - "/benefactor/kindboxreqs/": { + "/benefactors/kindboxreqs": { "get": { "security": [ { @@ -2057,7 +2053,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Get all KindBox requests", "parameters": [ @@ -2196,7 +2192,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Add a new kind box request for a benefactor", "parameters": [ @@ -2226,7 +2222,7 @@ const docTemplate = `{ } } }, - "/benefactor/kindboxreqs/{id}": { + "/benefactors/kindboxreqs/{id}": { "get": { "security": [ { @@ -2240,7 +2236,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Get a kind box request for a benefactor", "parameters": [ @@ -2280,7 +2276,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Update kind box request by benefactor", "parameters": [ @@ -2351,9 +2347,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], - "summary": "delete kindboxreq by benefactor", + "summary": "Delete kindboxreq by benefactor", "parameters": [ { "type": "integer", @@ -2379,7 +2375,7 @@ const docTemplate = `{ } } }, - "/benefactor/login-register": { + "/benefactors/login-register": { "post": { "description": "This endpoint is used to authenticate an existing benefactor account or register a new one.", "consumes": [ @@ -2389,7 +2385,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Benefactor" + "Benefactors" ], "summary": "Login or register a benefactor", "parameters": [ @@ -2419,7 +2415,7 @@ const docTemplate = `{ } } }, - "/benefactor/send-otp": { + "/benefactors/send-otp": { "post": { "description": "This endpoint sends an OTP to the benefactor's phone number for verification purposes.", "consumes": [ @@ -2429,7 +2425,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Benefactor" + "Benefactors" ], "summary": "Send OTP to benefactor", "parameters": [ @@ -2496,7 +2492,7 @@ const docTemplate = `{ "address": { "$ref": "#/definitions/entity.Address" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2510,7 +2506,7 @@ const docTemplate = `{ "address": { "$ref": "#/definitions/entity.Address" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2637,7 +2633,7 @@ const docTemplate = `{ "$ref": "#/definitions/entity.KindBox" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2669,7 +2665,7 @@ const docTemplate = `{ "deliveredAt": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2721,7 +2717,7 @@ const docTemplate = `{ "adminkindboxreqparam.AssignSenderResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2748,7 +2744,7 @@ const docTemplate = `{ "adminkindboxreqparam.DeliverKindBoxReqResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2765,7 +2761,7 @@ const docTemplate = `{ "$ref": "#/definitions/entity.KindBoxReq" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2803,7 +2799,7 @@ const docTemplate = `{ "description": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2850,7 +2846,7 @@ const docTemplate = `{ "description": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2893,7 +2889,7 @@ const docTemplate = `{ "deliver_refer_date": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2939,7 +2935,7 @@ const docTemplate = `{ "adminkindboxreqparam.KindBoxReqAddResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2959,7 +2955,7 @@ const docTemplate = `{ "$ref": "#/definitions/entity.KindBoxReq" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3002,7 +2998,7 @@ const docTemplate = `{ "type": "string", "example": "description" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3143,7 +3139,7 @@ const docTemplate = `{ "admin_info": { "$ref": "#/definitions/adminserviceparam.AdminInfo" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3213,7 +3209,7 @@ const docTemplate = `{ "admin": { "$ref": "#/definitions/entity.Admin" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3241,7 +3237,7 @@ const docTemplate = `{ "$ref": "#/definitions/entity.KindBox" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3273,7 +3269,7 @@ const docTemplate = `{ "deliveredAt": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3366,7 +3362,7 @@ const docTemplate = `{ "benefactore_info": { "$ref": "#/definitions/benefactoreparam.BenefactroInfo" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3393,7 +3389,7 @@ const docTemplate = `{ "description": "this just use in test .env\n\t\tTODO - remove it after test", "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3425,7 +3421,7 @@ const docTemplate = `{ "$ref": "#/definitions/entity.KindBox" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3457,7 +3453,7 @@ const docTemplate = `{ "deliveredAt": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3524,7 +3520,7 @@ const docTemplate = `{ "$ref": "#/definitions/entity.KindBoxReq" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3538,10 +3534,6 @@ const docTemplate = `{ "benefactorkindboxreqparam.KindBoxReqAddRequest": { "type": "object", "properties": { - "benefactor_id": { - "type": "integer", - "example": 1 - }, "count_requested": { "type": "integer", "example": 2 @@ -3571,7 +3563,7 @@ const docTemplate = `{ "benefactorkindboxreqparam.KindBoxReqAddResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3585,7 +3577,7 @@ const docTemplate = `{ "benefactorkindboxreqparam.KindBoxReqDeleteResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3596,7 +3588,7 @@ const docTemplate = `{ "benefactorkindboxreqparam.KindBoxReqGetResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" diff --git a/docs/swagger.json b/docs/swagger.json index 2915ebb..86a6211 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -4,11 +4,11 @@ "contact": {} }, "paths": { - "/address/": { + "/admins/agents": { "get": { "security": [ { - "AuthBearerBenefactor": [] + "AuthBearerAdmin": [] } ], "consumes": [ @@ -18,57 +18,14 @@ "application/json" ], "tags": [ - "Address" + "Admins" ], - "summary": "Get all benefactor addresses", + "summary": "Get all agents by admin", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/addressparam.GetAllAddressesResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "description": "This endpoint allows an authenticated benefactor to add a new address to their account.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Add a new address for a benefactor", - "parameters": [ - { - "description": "New address details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addressparam.BenefactorAddAddressRequest" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/addressparam.BenefactorAddAddressResponse" + "$ref": "#/definitions/adminagentparam.GetAllAgentResponse" } }, "400": { @@ -80,183 +37,7 @@ } } }, - "/address/cities": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Get all cities", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/addressparam.GetAllCitiesResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/address/provinces": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Get all provinces", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/addressparam.GetAllProvincesResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/address/{id}": { - "get": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Get a benefactor address", - "parameters": [ - { - "type": "integer", - "description": "Address ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/addressparam.GetAddressResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - }, - "delete": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "description": "This endpoint is used to delete an address by benefactor", - "tags": [ - "Address" - ], - "summary": "Delete address by benefactor", - "parameters": [ - { - "type": "integer", - "description": "Address ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - }, - "patch": { - "security": [ - { - "AuthBearerBenefactor": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Address" - ], - "summary": "Edit benefactor address", - "parameters": [ - { - "type": "integer", - "description": "Address ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Edit address details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addressparam.UpdateAddressRequest" - } - } - ], - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxes": { + "/admins/kindboxes": { "get": { "security": [ { @@ -271,7 +52,7 @@ "application/json" ], "tags": [ - "KindBox" + "Admins KindBoxes" ], "summary": "Get all KindBoxes by admin", "parameters": [ @@ -457,7 +238,50 @@ } } }, - "/admin/kindboxes/assign-receiver-agent/{id}": { + "/admins/kindboxes/{id}": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "description": "This endpoint retrieves a specific kind box by admin", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxes" + ], + "summary": "Get a specific kind box by admin", + "parameters": [ + { + "type": "integer", + "description": "Kind box ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxparam.KindBoxGetResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxes/{id}/assign-receiver-agent": { "patch": { "security": [ { @@ -471,7 +295,7 @@ "application/json" ], "tags": [ - "KindBox" + "Admins KindBoxes" ], "summary": "Admin assign receiver agent to kindbox", "parameters": [ @@ -505,50 +329,7 @@ } } }, - "/admin/kindboxes/{id}": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "description": "This endpoint retrieves a specific kind box by admin", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBox" - ], - "summary": "Get a specific kind box by admin", - "parameters": [ - { - "type": "integer", - "description": "Kind box ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxparam.KindBoxGetResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxes/{id}/enumerate": { + "/admins/kindboxes/{id}/enumerate": { "patch": { "security": [ { @@ -562,7 +343,7 @@ "application/json" ], "tags": [ - "KindBox" + "Admins KindBoxes" ], "summary": "Admin enumerate kindbox", "parameters": [ @@ -620,506 +401,6 @@ } } }, - "/admin/kindboxreqs": { - "post": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Add a new kind box request for a benefactor by admin", - "parameters": [ - { - "description": "New kind box request details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/accept-kind-box-req/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Accept kind box request by admin", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Accept KindBoxReq Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/assign-sender-agent/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Admin Assign Sender Agent to kindboxreq", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Assign Sender Agent Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.AssignSenderRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.AssignSenderResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/awaiting-delivery": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "description": "Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Get all awaiting delivery KindBox requests", - "parameters": [ - { - "type": "integer", - "description": "Filter by ID", - "name": "filter_id", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by benefactor ID", - "name": "filter_benefactor_id", - "in": "query" - }, - { - "enum": [ - "on-table", - "cylindrical", - "stand-up" - ], - "type": "string", - "format": "enum", - "description": "Filter by KindBox type", - "name": "filter_kind_box_type", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by count requested", - "name": "filter_count_requested", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by count accepted", - "name": "filter_count_accepted", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by deliver refer time ID", - "name": "filter_deliver_refer_time_id", - "in": "query" - }, - { - "type": "string", - "format": "date", - "description": "Filter by deliver refer date", - "name": "filter_deliver_refer_date", - "in": "query" - }, - { - "type": "integer", - "description": "Filter by deliver address ID", - "name": "filter_deliver_address_id", - "in": "query" - }, - { - "type": "integer", - "description": "Page number", - "name": "page_number", - "in": "query" - }, - { - "type": "integer", - "description": "Page size", - "name": "page_size", - "in": "query" - }, - { - "enum": [ - "id", - "benefactor_id", - "kind_box_type", - "count_requested", - "count_accepted", - "deliver_refer_time_id", - "deliver_refer_date", - "deliver_address_id" - ], - "type": "string", - "description": "Sort by field", - "name": "sort_field", - "in": "query" - }, - { - "enum": [ - "asc", - "desc" - ], - "type": "string", - "description": "Sort order", - "name": "sort_direction", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetAllResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/awaiting-delivery/{id}": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Get a kind box reqs that is awaiting delivery by agent", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/deliver-kind-box-req/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Admin deliver a kindboxreq", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "KindBoxReq deliver request details", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/reject-kind-box-req/{id}": { - "patch": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Reject a kindboxreq by admin", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq id", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "KindBoxReq Reject Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admin/kindboxreqs/{id}": { - "put": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "KindBoxReq" - ], - "summary": "Update kind box request by admin", - "parameters": [ - { - "type": "integer", - "description": "KindBoxReq ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "Update KindBoxReq Request Body", - "name": "Request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqUpdateRequest" - } - } - ], - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, - "/admins/agents": { - "get": { - "security": [ - { - "AuthBearerAdmin": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Admin" - ], - "summary": "Get all agents by admin", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/adminagentparam.GetAllAgentResponse" - } - }, - "400": { - "description": "Bad request", - "schema": { - "type": "string" - } - } - } - } - }, "/admins/kindboxreqs": { "get": { "security": [ @@ -1135,7 +416,7 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Admins KindBoxReqs" ], "summary": "Admin get all kindboxreq", "parameters": [ @@ -1301,6 +582,219 @@ } } } + }, + "post": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Add a new kind box request for a benefactor by admin", + "parameters": [ + { + "description": "New kind box request details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAddResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/awaiting-delivery": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "description": "Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Get all awaiting delivery KindBox requests", + "parameters": [ + { + "type": "integer", + "description": "Filter by ID", + "name": "filter_id", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by benefactor ID", + "name": "filter_benefactor_id", + "in": "query" + }, + { + "enum": [ + "on-table", + "cylindrical", + "stand-up" + ], + "type": "string", + "format": "enum", + "description": "Filter by KindBox type", + "name": "filter_kind_box_type", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by count requested", + "name": "filter_count_requested", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by count accepted", + "name": "filter_count_accepted", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by deliver refer time ID", + "name": "filter_deliver_refer_time_id", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "Filter by deliver refer date", + "name": "filter_deliver_refer_date", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by deliver address ID", + "name": "filter_deliver_address_id", + "in": "query" + }, + { + "type": "integer", + "description": "Page number", + "name": "page_number", + "in": "query" + }, + { + "type": "integer", + "description": "Page size", + "name": "page_size", + "in": "query" + }, + { + "enum": [ + "id", + "benefactor_id", + "kind_box_type", + "count_requested", + "count_accepted", + "deliver_refer_time_id", + "deliver_refer_date", + "deliver_address_id" + ], + "type": "string", + "description": "Sort by field", + "name": "sort_field", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "description": "Sort order", + "name": "sort_direction", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetAllResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/awaiting-delivery/{id}": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Get a kind box reqs that is awaiting delivery by agent", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliveryAwaitingGetResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } } }, "/admins/kindboxreqs/{id}": { @@ -1317,7 +811,7 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Admins KindBoxReqs" ], "summary": "Get a specific kind box req by ID", "parameters": [ @@ -1367,6 +861,256 @@ } } } + }, + "put": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Update kind box request by admin", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Update KindBoxReq Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqUpdateRequest" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/accept-kind-box-req": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Accept kind box request by admin", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Accept KindBoxReq Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqAcceptResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/assign-sender-agent": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Admin Assign Sender Agent to kindboxreq", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Assign Sender Agent Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.AssignSenderRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.AssignSenderResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/deliver-kind-box-req": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Admin deliver a kindboxreq", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "KindBoxReq deliver request details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.DeliverKindBoxReqResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/admins/kindboxreqs/{id}/reject-kind-box-req": { + "patch": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admins KindBoxReqs" + ], + "summary": "Reject a kindboxreq by admin", + "parameters": [ + { + "type": "integer", + "description": "KindBoxReq id", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "KindBoxReq Reject Request Body", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/adminkindboxreqparam.KindBoxReqRejectResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } } }, "/admins/login-by-phone": { @@ -1378,7 +1122,7 @@ "application/json" ], "tags": [ - "Admin" + "Admins" ], "summary": "Admin login by\tPhoneNumber", "parameters": [ @@ -1422,7 +1166,7 @@ "application/json" ], "tags": [ - "Admin" + "Admins" ], "summary": "Register an admin by super-admin", "parameters": [ @@ -1467,7 +1211,7 @@ "application/json" ], "tags": [ - "KindBox" + "Agents KindBoxes" ], "summary": "Get all awaiting return KindBoxes by agent", "parameters": [ @@ -1598,7 +1342,73 @@ } } }, - "/agents/kindboxes/return/{id}": { + "/agents/kindboxes/{id}": { + "get": { + "security": [ + { + "AuthBearerAdmin": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Agents KindBoxes" + ], + "summary": "Get a kind box that is awaiting return by agent", + "parameters": [ + { + "type": "integer", + "description": "KindBox ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/agentkindboxparam.GetKindBoxResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "string" + } + }, + "401": { + "description": "invalid or expired jwt", + "schema": { + "type": "string" + } + }, + "403": { + "description": "user not allowed", + "schema": { + "type": "string" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/httpmsg.ErrorResponse" + } + }, + "500": { + "description": "something went wrong", + "schema": { + "type": "string" + } + } + } + } + }, + "/agents/kindboxes/{id}/return": { "patch": { "security": [ { @@ -1612,7 +1422,7 @@ "application/json" ], "tags": [ - "KindBox" + "Agents KindBoxes" ], "summary": "Return KindBox from benefactor by agent", "parameters": [ @@ -1670,11 +1480,11 @@ } } }, - "/agents/kindboxes/{id}": { + "/benefactors/addresses": { "get": { "security": [ { - "AuthBearerAdmin": [] + "AuthBearerBenefactor": [] } ], "consumes": [ @@ -1684,13 +1494,145 @@ "application/json" ], "tags": [ - "KindBox" + "Benefactors Addresses" ], - "summary": "Get a kind box that is awaiting return by agent", + "summary": "Get all benefactor addresses", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/addressparam.GetAllAddressesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "description": "This endpoint allows an authenticated benefactor to add a new address to their account.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Add a new address for a benefactor", + "parameters": [ + { + "description": "New address details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/addressparam.BenefactorAddAddressRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/addressparam.BenefactorAddAddressResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/benefactors/addresses/cities": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Get all cities", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/addressparam.GetAllCitiesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/benefactors/addresses/provinces": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Get all provinces", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/addressparam.GetAllProvincesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "type": "string" + } + } + } + } + }, + "/benefactors/addresses/{id}": { + "get": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Get a benefactor address", "parameters": [ { "type": "integer", - "description": "KindBox ID", + "description": "Address ID", "name": "id", "in": "path", "required": true @@ -1700,35 +1642,89 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/agentkindboxparam.GetKindBoxResponse" + "$ref": "#/definitions/addressparam.GetAddressResponse" } }, "400": { - "description": "Bad Request", + "description": "Bad request", "schema": { "type": "string" } + } + } + }, + "put": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Benefactors Addresses" + ], + "summary": "Update benefactor address", + "parameters": [ + { + "type": "integer", + "description": "Address ID", + "name": "id", + "in": "path", + "required": true }, - "401": { - "description": "invalid or expired jwt", + { + "description": "Edit address details", + "name": "Request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/addressparam.UpdateAddressRequest" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad request", "schema": { "type": "string" } + } + } + }, + "delete": { + "security": [ + { + "AuthBearerBenefactor": [] + } + ], + "description": "This endpoint is used to delete an address by benefactor", + "tags": [ + "Benefactors Addresses" + ], + "summary": "Delete address by benefactor", + "parameters": [ + { + "type": "integer", + "description": "Address ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" }, - "403": { - "description": "user not allowed", - "schema": { - "type": "string" - } - }, - "422": { - "description": "Unprocessable Entity", - "schema": { - "$ref": "#/definitions/httpmsg.ErrorResponse" - } - }, - "500": { - "description": "something went wrong", + "400": { + "description": "Bad request", "schema": { "type": "string" } @@ -1736,7 +1732,7 @@ } } }, - "/benefactor/kindboxes": { + "/benefactors/kindboxes": { "get": { "security": [ { @@ -1751,7 +1747,7 @@ "application/json" ], "tags": [ - "KindBox" + "Benefactors KindBoxes" ], "summary": "Get all KindBoxes by benefactor", "parameters": [ @@ -1937,7 +1933,7 @@ } } }, - "/benefactor/kindboxes/{id}": { + "/benefactors/kindboxes/{id}": { "get": { "security": [ { @@ -1952,7 +1948,7 @@ "application/json" ], "tags": [ - "KindBox" + "Benefactors KindBoxes" ], "summary": "Get a specific kind box for a benefactor", "parameters": [ @@ -1980,7 +1976,7 @@ } } }, - "/benefactor/kindboxes/{id}/emptying-requests": { + "/benefactors/kindboxes/{id}/emptying-requests": { "patch": { "security": [ { @@ -1994,7 +1990,7 @@ "application/json" ], "tags": [ - "Benefactor" + "Benefactors KindBoxes" ], "summary": "Register a new emptying request for a kind box by benefactor", "parameters": [ @@ -2031,7 +2027,7 @@ } } }, - "/benefactor/kindboxreqs/": { + "/benefactors/kindboxreqs": { "get": { "security": [ { @@ -2046,7 +2042,7 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Get all KindBox requests", "parameters": [ @@ -2185,7 +2181,7 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Add a new kind box request for a benefactor", "parameters": [ @@ -2215,7 +2211,7 @@ } } }, - "/benefactor/kindboxreqs/{id}": { + "/benefactors/kindboxreqs/{id}": { "get": { "security": [ { @@ -2229,7 +2225,7 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Get a kind box request for a benefactor", "parameters": [ @@ -2269,7 +2265,7 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], "summary": "Update kind box request by benefactor", "parameters": [ @@ -2340,9 +2336,9 @@ "application/json" ], "tags": [ - "KindBoxReq" + "Benefactors KindBoxReqs" ], - "summary": "delete kindboxreq by benefactor", + "summary": "Delete kindboxreq by benefactor", "parameters": [ { "type": "integer", @@ -2368,7 +2364,7 @@ } } }, - "/benefactor/login-register": { + "/benefactors/login-register": { "post": { "description": "This endpoint is used to authenticate an existing benefactor account or register a new one.", "consumes": [ @@ -2378,7 +2374,7 @@ "application/json" ], "tags": [ - "Benefactor" + "Benefactors" ], "summary": "Login or register a benefactor", "parameters": [ @@ -2408,7 +2404,7 @@ } } }, - "/benefactor/send-otp": { + "/benefactors/send-otp": { "post": { "description": "This endpoint sends an OTP to the benefactor's phone number for verification purposes.", "consumes": [ @@ -2418,7 +2414,7 @@ "application/json" ], "tags": [ - "Benefactor" + "Benefactors" ], "summary": "Send OTP to benefactor", "parameters": [ @@ -2485,7 +2481,7 @@ "address": { "$ref": "#/definitions/entity.Address" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2499,7 +2495,7 @@ "address": { "$ref": "#/definitions/entity.Address" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2626,7 +2622,7 @@ "$ref": "#/definitions/entity.KindBox" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2658,7 +2654,7 @@ "deliveredAt": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2710,7 +2706,7 @@ "adminkindboxreqparam.AssignSenderResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2737,7 +2733,7 @@ "adminkindboxreqparam.DeliverKindBoxReqResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2754,7 +2750,7 @@ "$ref": "#/definitions/entity.KindBoxReq" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2792,7 +2788,7 @@ "description": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2839,7 +2835,7 @@ "description": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2882,7 +2878,7 @@ "deliver_refer_date": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2928,7 +2924,7 @@ "adminkindboxreqparam.KindBoxReqAddResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2948,7 +2944,7 @@ "$ref": "#/definitions/entity.KindBoxReq" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -2991,7 +2987,7 @@ "type": "string", "example": "description" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3132,7 +3128,7 @@ "admin_info": { "$ref": "#/definitions/adminserviceparam.AdminInfo" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3202,7 +3198,7 @@ "admin": { "$ref": "#/definitions/entity.Admin" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3230,7 +3226,7 @@ "$ref": "#/definitions/entity.KindBox" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3262,7 +3258,7 @@ "deliveredAt": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3355,7 +3351,7 @@ "benefactore_info": { "$ref": "#/definitions/benefactoreparam.BenefactroInfo" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3382,7 +3378,7 @@ "description": "this just use in test .env\n\t\tTODO - remove it after test", "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3414,7 +3410,7 @@ "$ref": "#/definitions/entity.KindBox" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3446,7 +3442,7 @@ "deliveredAt": { "type": "string" }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3513,7 +3509,7 @@ "$ref": "#/definitions/entity.KindBoxReq" } }, - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3527,10 +3523,6 @@ "benefactorkindboxreqparam.KindBoxReqAddRequest": { "type": "object", "properties": { - "benefactor_id": { - "type": "integer", - "example": 1 - }, "count_requested": { "type": "integer", "example": 2 @@ -3560,7 +3552,7 @@ "benefactorkindboxreqparam.KindBoxReqAddResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3574,7 +3566,7 @@ "benefactorkindboxreqparam.KindBoxReqDeleteResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" @@ -3585,7 +3577,7 @@ "benefactorkindboxreqparam.KindBoxReqGetResponse": { "type": "object", "properties": { - "fieldErrors": { + "field_errors": { "type": "object", "additionalProperties": { "type": "string" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 5225b2c..3350725 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -24,7 +24,7 @@ definitions: properties: address: $ref: '#/definitions/entity.Address' - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -33,7 +33,7 @@ definitions: properties: address: $ref: '#/definitions/entity.Address' - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -118,7 +118,7 @@ definitions: items: $ref: '#/definitions/entity.KindBox' type: array - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -139,7 +139,7 @@ definitions: type: integer deliveredAt: type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -173,7 +173,7 @@ definitions: type: object adminkindboxreqparam.AssignSenderResponse: properties: - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -191,7 +191,7 @@ definitions: type: object adminkindboxreqparam.DeliverKindBoxReqResponse: properties: - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -202,7 +202,7 @@ definitions: items: $ref: '#/definitions/entity.KindBoxReq' type: array - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -227,7 +227,7 @@ definitions: type: string description: type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -258,7 +258,7 @@ definitions: type: string description: type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -286,7 +286,7 @@ definitions: type: integer deliver_refer_date: type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -316,7 +316,7 @@ definitions: type: object adminkindboxreqparam.KindBoxReqAddResponse: properties: - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -329,7 +329,7 @@ definitions: items: $ref: '#/definitions/entity.KindBoxReq' type: array - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -359,7 +359,7 @@ definitions: description: example: description type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -449,7 +449,7 @@ definitions: properties: admin_info: $ref: '#/definitions/adminserviceparam.AdminInfo' - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -493,7 +493,7 @@ definitions: properties: admin: $ref: '#/definitions/entity.Admin' - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -511,7 +511,7 @@ definitions: items: $ref: '#/definitions/entity.KindBox' type: array - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -532,7 +532,7 @@ definitions: type: integer deliveredAt: type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -593,7 +593,7 @@ definitions: properties: benefactore_info: $ref: '#/definitions/benefactoreparam.BenefactroInfo' - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -611,7 +611,7 @@ definitions: code: description: "this just use in test .env\n\t\tTODO - remove it after test" type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -632,7 +632,7 @@ definitions: items: $ref: '#/definitions/entity.KindBox' type: array - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -653,7 +653,7 @@ definitions: type: integer deliveredAt: type: string - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -698,7 +698,7 @@ definitions: items: $ref: '#/definitions/entity.KindBoxReq' type: array - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -707,9 +707,6 @@ definitions: type: object benefactorkindboxreqparam.KindBoxReqAddRequest: properties: - benefactor_id: - example: 1 - type: integer count_requested: example: 2 type: integer @@ -729,7 +726,7 @@ definitions: type: object benefactorkindboxreqparam.KindBoxReqAddResponse: properties: - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -738,14 +735,14 @@ definitions: type: object benefactorkindboxreqparam.KindBoxReqDeleteResponse: properties: - fieldErrors: + field_errors: additionalProperties: type: string type: object type: object benefactorkindboxreqparam.KindBoxReqGetResponse: properties: - fieldErrors: + field_errors: additionalProperties: type: string type: object @@ -992,7 +989,7 @@ definitions: info: contact: {} paths: - /address/: + /admins/agents: get: consumes: - application/json @@ -1002,156 +999,17 @@ paths: "200": description: OK schema: - $ref: '#/definitions/addressparam.GetAllAddressesResponse' + $ref: '#/definitions/adminagentparam.GetAllAgentResponse' "400": description: Bad request schema: type: string security: - - AuthBearerBenefactor: [] - summary: Get all benefactor addresses + - AuthBearerAdmin: [] + summary: Get all agents by admin tags: - - Address - post: - consumes: - - application/json - description: This endpoint allows an authenticated benefactor to add a new address - to their account. - parameters: - - description: New address details - in: body - name: Request - required: true - schema: - $ref: '#/definitions/addressparam.BenefactorAddAddressRequest' - produces: - - application/json - responses: - "201": - description: Created - schema: - $ref: '#/definitions/addressparam.BenefactorAddAddressResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerBenefactor: [] - summary: Add a new address for a benefactor - tags: - - Address - /address/{id}: - delete: - description: This endpoint is used to delete an address by benefactor - parameters: - - description: Address ID - in: path - name: id - required: true - type: integer - responses: - "204": - description: No Content - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerBenefactor: [] - summary: Delete address by benefactor - tags: - - Address - get: - consumes: - - application/json - parameters: - - description: Address ID - in: path - name: id - required: true - type: integer - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/addressparam.GetAddressResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerBenefactor: [] - summary: Get a benefactor address - tags: - - Address - patch: - consumes: - - application/json - parameters: - - description: Address ID - in: path - name: id - required: true - type: integer - - description: Edit address details - in: body - name: Request - required: true - schema: - $ref: '#/definitions/addressparam.UpdateAddressRequest' - produces: - - application/json - responses: - "204": - description: No Content - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerBenefactor: [] - summary: Edit benefactor address - tags: - - Address - /address/cities: - get: - consumes: - - application/json - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/addressparam.GetAllCitiesResponse' - "400": - description: Bad request - schema: - type: string - summary: Get all cities - tags: - - Address - /address/provinces: - get: - consumes: - - application/json - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/addressparam.GetAllProvincesResponse' - "400": - description: Bad request - schema: - type: string - summary: Get all provinces - tags: - - Address - /admin/kindboxes: + - Admins + /admins/kindboxes: get: consumes: - application/json @@ -1292,8 +1150,8 @@ paths: - AuthBearerAdmin: [] summary: Get all KindBoxes by admin tags: - - KindBox - /admin/kindboxes/{id}: + - Admins KindBoxes + /admins/kindboxes/{id}: get: consumes: - application/json @@ -1319,8 +1177,38 @@ paths: - AuthBearerAdmin: [] summary: Get a specific kind box by admin tags: - - KindBox - /admin/kindboxes/{id}/enumerate: + - Admins KindBoxes + /admins/kindboxes/{id}/assign-receiver-agent: + patch: + consumes: + - application/json + parameters: + - description: KindBox ID + in: path + name: id + required: true + type: integer + - description: Assign Receiver Agent Request Body + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxparam.AssignReceiverRequest' + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Admin assign receiver agent to kindbox + tags: + - Admins KindBoxes + /admins/kindboxes/{id}/enumerate: patch: consumes: - application/json @@ -1365,357 +1253,7 @@ paths: - AuthBearerAdmin: [] summary: Admin enumerate kindbox tags: - - KindBox - /admin/kindboxes/assign-receiver-agent/{id}: - patch: - consumes: - - application/json - parameters: - - description: KindBox ID - in: path - name: id - required: true - type: integer - - description: Assign Receiver Agent Request Body - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxparam.AssignReceiverRequest' - produces: - - application/json - responses: - "204": - description: No Content - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Admin assign receiver agent to kindbox - tags: - - KindBox - /admin/kindboxreqs: - post: - consumes: - - application/json - parameters: - - description: New kind box request details - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAddRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAddResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Add a new kind box request for a benefactor by admin - tags: - - KindBoxReq - /admin/kindboxreqs/{id}: - put: - consumes: - - application/json - parameters: - - description: KindBoxReq ID - in: path - name: id - required: true - type: integer - - description: Update KindBoxReq Request Body - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqUpdateRequest' - produces: - - application/json - responses: - "204": - description: No Content - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Update kind box request by admin - tags: - - KindBoxReq - /admin/kindboxreqs/accept-kind-box-req/{id}: - patch: - consumes: - - application/json - parameters: - - description: KindBoxReq ID - in: path - name: id - required: true - type: integer - - description: Accept KindBoxReq Request Body - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAcceptRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAcceptResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Accept kind box request by admin - tags: - - KindBoxReq - /admin/kindboxreqs/assign-sender-agent/{id}: - patch: - consumes: - - application/json - parameters: - - description: KindBoxReq ID - in: path - name: id - required: true - type: integer - - description: Assign Sender Agent Request Body - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxreqparam.AssignSenderRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.AssignSenderResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Admin Assign Sender Agent to kindboxreq - tags: - - KindBoxReq - /admin/kindboxreqs/awaiting-delivery: - get: - consumes: - - application/json - description: Retrieves a list of all awaiting KindBox requests with filtering, - sorting, and pagination options - parameters: - - description: Filter by ID - in: query - name: filter_id - type: integer - - description: Filter by benefactor ID - in: query - name: filter_benefactor_id - type: integer - - description: Filter by KindBox type - enum: - - on-table - - cylindrical - - stand-up - format: enum - in: query - name: filter_kind_box_type - type: string - - description: Filter by count requested - in: query - name: filter_count_requested - type: integer - - description: Filter by count accepted - in: query - name: filter_count_accepted - type: integer - - description: Filter by deliver refer time ID - in: query - name: filter_deliver_refer_time_id - type: integer - - description: Filter by deliver refer date - format: date - in: query - name: filter_deliver_refer_date - type: string - - description: Filter by deliver address ID - in: query - name: filter_deliver_address_id - type: integer - - description: Page number - in: query - name: page_number - type: integer - - description: Page size - in: query - name: page_size - type: integer - - description: Sort by field - enum: - - id - - benefactor_id - - kind_box_type - - count_requested - - count_accepted - - deliver_refer_time_id - - deliver_refer_date - - deliver_address_id - in: query - name: sort_field - type: string - - description: Sort order - enum: - - asc - - desc - in: query - name: sort_direction - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.DeliveryAwaitingGetAllResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Get all awaiting delivery KindBox requests - tags: - - KindBoxReq - /admin/kindboxreqs/awaiting-delivery/{id}: - get: - consumes: - - application/json - parameters: - - description: KindBoxReq ID - in: path - name: id - required: true - type: integer - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.DeliveryAwaitingGetResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Get a kind box reqs that is awaiting delivery by agent - tags: - - KindBoxReq - /admin/kindboxreqs/deliver-kind-box-req/{id}: - patch: - consumes: - - application/json - parameters: - - description: KindBoxReq ID - in: path - name: id - required: true - type: integer - - description: KindBoxReq deliver request details - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxreqparam.DeliverKindBoxReqRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.DeliverKindBoxReqResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Admin deliver a kindboxreq - tags: - - KindBoxReq - /admin/kindboxreqs/reject-kind-box-req/{id}: - patch: - consumes: - - application/json - parameters: - - description: KindBoxReq id - in: path - name: id - required: true - type: integer - - description: KindBoxReq Reject Request Body - in: body - name: Request - required: true - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqRejectRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminkindboxreqparam.KindBoxReqRejectResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Reject a kindboxreq by admin - tags: - - KindBoxReq - /admins/agents: - get: - consumes: - - application/json - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/adminagentparam.GetAllAgentResponse' - "400": - description: Bad request - schema: - type: string - security: - - AuthBearerAdmin: [] - summary: Get all agents by admin - tags: - - Admin + - Admins KindBoxes /admins/kindboxreqs: get: consumes: @@ -1843,7 +1381,33 @@ paths: - AuthBearerAdmin: [] summary: Admin get all kindboxreq tags: - - KindBoxReq + - Admins KindBoxReqs + post: + consumes: + - application/json + parameters: + - description: New kind box request details + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAddRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAddResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Add a new kind box request for a benefactor by admin + tags: + - Admins KindBoxReqs /admins/kindboxreqs/{id}: get: consumes: @@ -1885,7 +1449,279 @@ paths: - AuthBearerAdmin: [] summary: Get a specific kind box req by ID tags: - - KindBoxReq + - Admins KindBoxReqs + put: + consumes: + - application/json + parameters: + - description: KindBoxReq ID + in: path + name: id + required: true + type: integer + - description: Update KindBoxReq Request Body + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqUpdateRequest' + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Update kind box request by admin + tags: + - Admins KindBoxReqs + /admins/kindboxreqs/{id}/accept-kind-box-req: + patch: + consumes: + - application/json + parameters: + - description: KindBoxReq ID + in: path + name: id + required: true + type: integer + - description: Accept KindBoxReq Request Body + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAcceptRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqAcceptResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Accept kind box request by admin + tags: + - Admins KindBoxReqs + /admins/kindboxreqs/{id}/assign-sender-agent: + patch: + consumes: + - application/json + parameters: + - description: KindBoxReq ID + in: path + name: id + required: true + type: integer + - description: Assign Sender Agent Request Body + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxreqparam.AssignSenderRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.AssignSenderResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Admin Assign Sender Agent to kindboxreq + tags: + - Admins KindBoxReqs + /admins/kindboxreqs/{id}/deliver-kind-box-req: + patch: + consumes: + - application/json + parameters: + - description: KindBoxReq ID + in: path + name: id + required: true + type: integer + - description: KindBoxReq deliver request details + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxreqparam.DeliverKindBoxReqRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.DeliverKindBoxReqResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Admin deliver a kindboxreq + tags: + - Admins KindBoxReqs + /admins/kindboxreqs/{id}/reject-kind-box-req: + patch: + consumes: + - application/json + parameters: + - description: KindBoxReq id + in: path + name: id + required: true + type: integer + - description: KindBoxReq Reject Request Body + in: body + name: Request + required: true + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqRejectRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.KindBoxReqRejectResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Reject a kindboxreq by admin + tags: + - Admins KindBoxReqs + /admins/kindboxreqs/awaiting-delivery: + get: + consumes: + - application/json + description: Retrieves a list of all awaiting KindBox requests with filtering, + sorting, and pagination options + parameters: + - description: Filter by ID + in: query + name: filter_id + type: integer + - description: Filter by benefactor ID + in: query + name: filter_benefactor_id + type: integer + - description: Filter by KindBox type + enum: + - on-table + - cylindrical + - stand-up + format: enum + in: query + name: filter_kind_box_type + type: string + - description: Filter by count requested + in: query + name: filter_count_requested + type: integer + - description: Filter by count accepted + in: query + name: filter_count_accepted + type: integer + - description: Filter by deliver refer time ID + in: query + name: filter_deliver_refer_time_id + type: integer + - description: Filter by deliver refer date + format: date + in: query + name: filter_deliver_refer_date + type: string + - description: Filter by deliver address ID + in: query + name: filter_deliver_address_id + type: integer + - description: Page number + in: query + name: page_number + type: integer + - description: Page size + in: query + name: page_size + type: integer + - description: Sort by field + enum: + - id + - benefactor_id + - kind_box_type + - count_requested + - count_accepted + - deliver_refer_time_id + - deliver_refer_date + - deliver_address_id + in: query + name: sort_field + type: string + - description: Sort order + enum: + - asc + - desc + in: query + name: sort_direction + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.DeliveryAwaitingGetAllResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Get all awaiting delivery KindBox requests + tags: + - Admins KindBoxReqs + /admins/kindboxreqs/awaiting-delivery/{id}: + get: + consumes: + - application/json + parameters: + - description: KindBoxReq ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/adminkindboxreqparam.DeliveryAwaitingGetResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerAdmin: [] + summary: Get a kind box reqs that is awaiting delivery by agent + tags: + - Admins KindBoxReqs /admins/login-by-phone: post: consumes: @@ -1910,7 +1746,7 @@ paths: type: string summary: "Admin login by\tPhoneNumber" tags: - - Admin + - Admins /admins/register: post: consumes: @@ -1937,7 +1773,7 @@ paths: - AuthBearerAdmin: [] summary: Register an admin by super-admin tags: - - Admin + - Admins /agents/kindboxes: get: consumes: @@ -2037,7 +1873,7 @@ paths: - AuthBearerAdmin: [] summary: Get all awaiting return KindBoxes by agent tags: - - KindBox + - Agents KindBoxes /agents/kindboxes/{id}: get: consumes: @@ -2079,8 +1915,8 @@ paths: - AuthBearerAdmin: [] summary: Get a kind box that is awaiting return by agent tags: - - KindBox - /agents/kindboxes/return/{id}: + - Agents KindBoxes + /agents/kindboxes/{id}/return: patch: consumes: - application/json @@ -2125,8 +1961,167 @@ paths: - AuthBearerAdmin: [] summary: Return KindBox from benefactor by agent tags: - - KindBox - /benefactor/kindboxes: + - Agents KindBoxes + /benefactors/addresses: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/addressparam.GetAllAddressesResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerBenefactor: [] + summary: Get all benefactor addresses + tags: + - Benefactors Addresses + post: + consumes: + - application/json + description: This endpoint allows an authenticated benefactor to add a new address + to their account. + parameters: + - description: New address details + in: body + name: Request + required: true + schema: + $ref: '#/definitions/addressparam.BenefactorAddAddressRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/addressparam.BenefactorAddAddressResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerBenefactor: [] + summary: Add a new address for a benefactor + tags: + - Benefactors Addresses + /benefactors/addresses/{id}: + delete: + description: This endpoint is used to delete an address by benefactor + parameters: + - description: Address ID + in: path + name: id + required: true + type: integer + responses: + "204": + description: No Content + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerBenefactor: [] + summary: Delete address by benefactor + tags: + - Benefactors Addresses + get: + consumes: + - application/json + parameters: + - description: Address ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/addressparam.GetAddressResponse' + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerBenefactor: [] + summary: Get a benefactor address + tags: + - Benefactors Addresses + put: + consumes: + - application/json + parameters: + - description: Address ID + in: path + name: id + required: true + type: integer + - description: Edit address details + in: body + name: Request + required: true + schema: + $ref: '#/definitions/addressparam.UpdateAddressRequest' + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad request + schema: + type: string + security: + - AuthBearerBenefactor: [] + summary: Update benefactor address + tags: + - Benefactors Addresses + /benefactors/addresses/cities: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/addressparam.GetAllCitiesResponse' + "400": + description: Bad request + schema: + type: string + summary: Get all cities + tags: + - Benefactors Addresses + /benefactors/addresses/provinces: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/addressparam.GetAllProvincesResponse' + "400": + description: Bad request + schema: + type: string + summary: Get all provinces + tags: + - Benefactors Addresses + /benefactors/kindboxes: get: consumes: - application/json @@ -2267,8 +2262,8 @@ paths: - AuthBearerBenefactor: [] summary: Get all KindBoxes by benefactor tags: - - KindBox - /benefactor/kindboxes/{id}: + - Benefactors KindBoxes + /benefactors/kindboxes/{id}: get: consumes: - application/json @@ -2295,8 +2290,8 @@ paths: - AuthBearerBenefactor: [] summary: Get a specific kind box for a benefactor tags: - - KindBox - /benefactor/kindboxes/{id}/emptying-requests: + - Benefactors KindBoxes + /benefactors/kindboxes/{id}/emptying-requests: patch: consumes: - application/json @@ -2327,8 +2322,8 @@ paths: - AuthBearerBenefactor: [] summary: Register a new emptying request for a kind box by benefactor tags: - - Benefactor - /benefactor/kindboxreqs/: + - Benefactors KindBoxes + /benefactors/kindboxreqs: get: consumes: - application/json @@ -2426,7 +2421,7 @@ paths: - AuthBearerBenefactor: [] summary: Get all KindBox requests tags: - - KindBoxReq + - Benefactors KindBoxReqs post: consumes: - application/json @@ -2452,8 +2447,8 @@ paths: - AuthBearerBenefactor: [] summary: Add a new kind box request for a benefactor tags: - - KindBoxReq - /benefactor/kindboxreqs/{id}: + - Benefactors KindBoxReqs + /benefactors/kindboxreqs/{id}: delete: consumes: - application/json @@ -2478,9 +2473,9 @@ paths: type: string security: - AuthBearerBenefactor: [] - summary: delete kindboxreq by benefactor + summary: Delete kindboxreq by benefactor tags: - - KindBoxReq + - Benefactors KindBoxReqs get: consumes: - application/json @@ -2505,7 +2500,7 @@ paths: - AuthBearerBenefactor: [] summary: Get a kind box request for a benefactor tags: - - KindBoxReq + - Benefactors KindBoxReqs put: consumes: - application/json @@ -2550,8 +2545,8 @@ paths: - AuthBearerBenefactor: [] summary: Update kind box request by benefactor tags: - - KindBoxReq - /benefactor/login-register: + - Benefactors KindBoxReqs + /benefactors/login-register: post: consumes: - application/json @@ -2577,8 +2572,8 @@ paths: type: string summary: Login or register a benefactor tags: - - Benefactor - /benefactor/send-otp: + - Benefactors + /benefactors/send-otp: post: consumes: - application/json @@ -2604,7 +2599,7 @@ paths: type: string summary: Send OTP to benefactor tags: - - Benefactor + - Benefactors securityDefinitions: AuthBearerAdmin: description: Type the word 'Bearer' followed by a space and Admin JWT token. diff --git a/repository/mysql/kind_box/add.go b/repository/mysql/kind_box/add.go index 5c5d77c..1c37997 100644 --- a/repository/mysql/kind_box/add.go +++ b/repository/mysql/kind_box/add.go @@ -3,7 +3,6 @@ package mysqlkindbox import ( "context" "database/sql" - "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" querytransaction "git.gocasts.ir/ebhomengo/niki/pkg/query_transaction/sql"