forked from ebhomengo/niki
1
0
Fork 0

Merge pull request 'docs(niki): update swagger api documentation' (#147) from stage/erfan/swagger-api-docs into develop

Reviewed-on: ebhomengo/niki#147
This commit is contained in:
hossein 2024-09-03 05:27:16 +00:00
commit 2682de1eac
48 changed files with 2320 additions and 2342 deletions

View File

@ -10,7 +10,7 @@ import (
// LoginByPhoneNumber godoc // LoginByPhoneNumber godoc
// @Summary Admin login by PhoneNumber // @Summary Admin login by PhoneNumber
// @Tags Admin // @Tags Admins
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body adminserviceparam.LoginWithPhoneNumberRequest true "Admin login request body" // @Param Request body adminserviceparam.LoginWithPhoneNumberRequest true "Admin login request body"

View File

@ -10,7 +10,7 @@ import (
// Register godoc // Register godoc
// @Summary Register an admin by super-admin // @Summary Register an admin by super-admin
// @Tags Admin // @Tags Admins
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body adminserviceparam.RegisterRequest true "Admin Register Request Body" // @Param Request body adminserviceparam.RegisterRequest true "Admin Register Request Body"

View File

@ -10,7 +10,7 @@ import (
// GetAllAgent godoc // GetAllAgent godoc
// @Summary Get all agents by admin // @Summary Get all agents by admin
// @Tags Admin // @Tags Admins
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} adminagentparam.GetAllAgentResponse // @Success 200 {object} adminagentparam.GetAllAgentResponse

View File

@ -11,7 +11,7 @@ import (
// AssignReceiverAgent godoc // AssignReceiverAgent godoc
// @Summary Admin assign receiver agent to kindbox // @Summary Admin assign receiver agent to kindbox
// @Tags KindBox // @Tags Admins KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBox ID" // @Param id path int true "KindBox ID"
@ -19,7 +19,7 @@ import (
// @Success 204 // @Success 204
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @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 { func (h Handler) AssignReceiverAgent(c echo.Context) error {
var req param.AssignReceiverRequest var req param.AssignReceiverRequest

View File

@ -11,7 +11,7 @@ import (
// Enumerate godoc // Enumerate godoc
// @Summary Admin enumerate kindbox // @Summary Admin enumerate kindbox
// @Tags KindBox // @Tags Admins KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBox ID" // @Param id path int true "KindBox ID"
@ -23,7 +23,7 @@ import (
// @Failure 422 {object} httpmsg.ErrorResponse // @Failure 422 {object} httpmsg.ErrorResponse
// @Failure 500 {string} "something went wrong" // @Failure 500 {string} "something went wrong"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxes/{id}/enumerate [patch]. // @Router /admins/kindboxes/{id}/enumerate [patch].
func (h Handler) Enumerate(c echo.Context) error { func (h Handler) Enumerate(c echo.Context) error {
var req param.EnumerateKindBoxRequest var req param.EnumerateKindBoxRequest

View File

@ -11,14 +11,14 @@ import (
// Get godoc // Get godoc
// @Summary Get a specific kind box by admin // @Summary Get a specific kind box by admin
// @Description This endpoint retrieves a specific kind box by admin // @Description This endpoint retrieves a specific kind box by admin
// @Tags KindBox // @Tags Admins KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Kind box ID" // @Param id path int true "Kind box ID"
// @Success 200 {object} param.KindBoxGetResponse // @Success 200 {object} param.KindBoxGetResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxes/{id} [get]. // @Router /admins/kindboxes/{id} [get].
func (h Handler) Get(c echo.Context) error { func (h Handler) Get(c echo.Context) error {
var req param.KindBoxGetRequest var req param.KindBoxGetRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -12,7 +12,7 @@ import (
// GetAll godoc // GetAll godoc
// @Summary Get all KindBoxes by admin // @Summary Get all KindBoxes by admin
// @Description Retrieves a list of all KindBoxes with filtering, sorting, and pagination options // @Description Retrieves a list of all KindBoxes with filtering, sorting, and pagination options
// @Tags KindBox // @Tags Admins KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param filter_id query int false "Filter by ID" // @Param filter_id query int false "Filter by ID"
@ -39,7 +39,7 @@ import (
// @Success 200 {object} param.KindBoxGetAllResponse // @Success 200 {object} param.KindBoxGetAllResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxes [get]. // @Router /admins/kindboxes [get].
func (h Handler) GetAll(c echo.Context) error { func (h Handler) GetAll(c echo.Context) error {
var req param.KindBoxGetAllRequest var req param.KindBoxGetAllRequest

View File

@ -7,12 +7,12 @@ import (
) )
func (h Handler) SetRoutes(e *echo.Echo) { func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/admin/kindboxes") r := e.Group("/admins/kindboxes")
r.Use(middleware.Auth(h.authSvc)) r.Use(middleware.Auth(h.authSvc))
r.GET("/:id", h.Get, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetPermission)) 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.GET("", h.GetAll, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetAllPermission))
r.PATCH("/:id/enumerate", h.Enumerate, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxEnumeratePermission)) r.PATCH("/:id/enumerate", h.Enumerate, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxEnumeratePermission))
} }

View File

@ -13,7 +13,7 @@ import (
// Accept godoc // Accept godoc
// @Summary Accept kind box request by admin // @Summary Accept kind box request by admin
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"
@ -21,7 +21,7 @@ import (
// @Success 200 {object} param.KindBoxReqAcceptResponse // @Success 200 {object} param.KindBoxReqAcceptResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @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 { func (h Handler) Accept(c echo.Context) error {
var req param.KindBoxReqAcceptRequest var req param.KindBoxReqAcceptRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -11,14 +11,14 @@ import (
// AddKindBoxReq godoc // AddKindBoxReq godoc
// @Summary Add a new kind box request for a benefactor by admin // @Summary Add a new kind box request for a benefactor by admin
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body param.KindBoxReqAddRequest true "New kind box request details" // @Param Request body param.KindBoxReqAddRequest true "New kind box request details"
// @Success 200 {object} param.KindBoxReqAddResponse // @Success 200 {object} param.KindBoxReqAddResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxreqs [post]. // @Router /admins/kindboxreqs [post].
func (h Handler) AddKindBoxReq(c echo.Context) error { func (h Handler) AddKindBoxReq(c echo.Context) error {
req := param.KindBoxReqAddRequest{} req := param.KindBoxReqAddRequest{}
if err := c.Bind(&req); err != nil { if err := c.Bind(&req); err != nil {

View File

@ -13,7 +13,7 @@ import (
// AssignSenderAgent godoc // AssignSenderAgent godoc
// @Summary Admin Assign Sender Agent to kindboxreq // @Summary Admin Assign Sender Agent to kindboxreq
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"
@ -21,7 +21,7 @@ import (
// @Success 200 {object} param.AssignSenderResponse // @Success 200 {object} param.AssignSenderResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @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 { func (h Handler) AssignSenderAgent(c echo.Context) error {
var req param.AssignSenderRequest var req param.AssignSenderRequest

View File

@ -13,7 +13,7 @@ import (
// Deliver godoc // Deliver godoc
// @Summary Admin deliver a kindboxreq // @Summary Admin deliver a kindboxreq
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"
@ -21,7 +21,7 @@ import (
// @Success 200 {object} param.DeliverKindBoxReqResponse // @Success 200 {object} param.DeliverKindBoxReqResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @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 { func (h Handler) Deliver(c echo.Context) error {
var req param.DeliverKindBoxReqRequest var req param.DeliverKindBoxReqRequest

View File

@ -10,7 +10,7 @@ import (
// Get godoc // Get godoc
// @Summary Get a specific kind box req by ID // @Summary Get a specific kind box req by ID
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"

View File

@ -12,7 +12,7 @@ import (
// GetAll godoc // GetAll godoc
// @Summary Admin get all kindboxreq // @Summary Admin get all kindboxreq
// @Description Retrieves a list of all KindBox requests with filtering, sorting, and pagination options // @Description Retrieves a list of all KindBox requests with filtering, sorting, and pagination options
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param filter_id query int false "Filter by ID" // @Param filter_id query int false "Filter by ID"

View File

@ -14,7 +14,7 @@ import (
// GetAllAwaitingDelivery godoc // GetAllAwaitingDelivery godoc
// @Summary Get all awaiting delivery KindBox requests // @Summary Get all awaiting delivery KindBox requests
// @Description Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options // @Description Retrieves a list of all awaiting KindBox requests with filtering, sorting, and pagination options
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param filter_id query int false "Filter by ID" // @Param filter_id query int false "Filter by ID"
@ -32,7 +32,7 @@ import (
// @Success 200 {object} param.DeliveryAwaitingGetAllResponse // @Success 200 {object} param.DeliveryAwaitingGetAllResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxreqs/awaiting-delivery [get]. // @Router /admins/kindboxreqs/awaiting-delivery [get].
func (h Handler) GetAllAwaitingDelivery(c echo.Context) error { func (h Handler) GetAllAwaitingDelivery(c echo.Context) error {
var req param.DeliveryAwaitingGetAllRequest var req param.DeliveryAwaitingGetAllRequest

View File

@ -11,14 +11,14 @@ import (
// GetAwaitingDelivery godoc // GetAwaitingDelivery godoc
// @Summary Get a kind box reqs that is awaiting delivery by agent // @Summary Get a kind box reqs that is awaiting delivery by agent
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"
// @Success 200 {object} param.DeliveryAwaitingGetResponse // @Success 200 {object} param.DeliveryAwaitingGetResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxreqs/awaiting-delivery/{id} [get]. // @Router /admins/kindboxreqs/awaiting-delivery/{id} [get].
func (h Handler) GetAwaitingDelivery(c echo.Context) error { func (h Handler) GetAwaitingDelivery(c echo.Context) error {
var req param.DeliveryAwaitingGetRequest var req param.DeliveryAwaitingGetRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -13,7 +13,7 @@ import (
// Reject godoc // Reject godoc
// @Summary Reject a kindboxreq by admin // @Summary Reject a kindboxreq by admin
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq id" // @Param id path int true "KindBoxReq id"
@ -21,7 +21,7 @@ import (
// @Success 200 {object} param.KindBoxReqRejectResponse // @Success 200 {object} param.KindBoxReqRejectResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @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 { func (h Handler) Reject(c echo.Context) error {
var req param.KindBoxReqRejectRequest var req param.KindBoxReqRejectRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -11,10 +11,10 @@ func (h Handler) SetRoutes(e *echo.Echo) {
r.Use(middleware.Auth(h.authSvc)) r.Use(middleware.Auth(h.authSvc))
r.POST("", h.AddKindBoxReq, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAddPermission)) 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("/:id/accept-kind-box-req", 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("/:id/reject-kind-box-req", 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("/:id/deliver-kind-box-req", 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/assign-sender-agent", h.AssignSenderAgent, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAssignSenderAgentPermission))
r.GET("", h.GetAll, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAllPermission)) 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/:id", h.GetAwaitingDelivery, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAwaitingDeliveryPermission))
r.GET("/awaiting-delivery", h.GetAllAwaitingDelivery, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAwaitingDeliveryPermission)) r.GET("/awaiting-delivery", h.GetAllAwaitingDelivery, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqGetAwaitingDeliveryPermission))

View File

@ -10,7 +10,7 @@ import (
// Update godoc // Update godoc
// @Summary Update kind box request by admin // @Summary Update kind box request by admin
// @Tags KindBoxReq // @Tags Admins KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"
@ -18,7 +18,7 @@ import (
// @Success 204 // @Success 204
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /admin/kindboxreqs/{id} [put]. // @Router /admins/kindboxreqs/{id} [put].
func (h Handler) Update(c echo.Context) error { func (h Handler) Update(c echo.Context) error {
var req param.KindBoxReqUpdateRequest var req param.KindBoxReqUpdateRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -11,7 +11,7 @@ import (
// Get godoc // Get godoc
// @Summary Get a kind box that is awaiting return by agent // @Summary Get a kind box that is awaiting return by agent
// @Tags KindBox // @Tags Agents KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBox ID" // @Param id path int true "KindBox ID"

View File

@ -14,7 +14,7 @@ import (
// GetAll godoc // GetAll godoc
// @Summary Get all awaiting return KindBoxes by agent // @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 // @Description Retrieves a list of all awaiting return KindBoxes for agent with filtering, sorting, and pagination options
// @Tags KindBox // @Tags Agents KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param filter_id query int false "Filter by ID" // @Param filter_id query int false "Filter by ID"

View File

@ -11,7 +11,7 @@ import (
// Return godoc // Return godoc
// @Summary Return KindBox from benefactor by agent // @Summary Return KindBox from benefactor by agent
// @Tags KindBox // @Tags Agents KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBox ID" // @Param id path int true "KindBox ID"
@ -23,7 +23,7 @@ import (
// @Failure 422 {object} httpmsg.ErrorResponse // @Failure 422 {object} httpmsg.ErrorResponse
// @Failure 500 {string} "something went wrong" // @Failure 500 {string} "something went wrong"
// @Security AuthBearerAdmin // @Security AuthBearerAdmin
// @Router /agents/kindboxes/return/{id} [patch]. // @Router /agents/kindboxes/{id}/return [patch].
func (h Handler) Return(c echo.Context) error { func (h Handler) Return(c echo.Context) error {
var req param.ReturnKindBoxRequest var req param.ReturnKindBoxRequest
if err := c.Bind(&req); err != nil { if err := c.Bind(&req); err != nil {

View File

@ -13,5 +13,5 @@ func (h Handler) SetRoutes(e *echo.Echo) {
r.GET("/:id", h.Get, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetAwaitingReturnPermission)) r.GET("/:id", h.Get, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxGetAwaitingReturnPermission))
r.GET("", h.GetAll, 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))
} }

View File

@ -12,14 +12,14 @@ import (
// AddAddress godoc // AddAddress godoc
// @Summary Add a new address for a benefactor // @Summary Add a new address for a benefactor
// @Description This endpoint allows an authenticated benefactor to add a new address to their account. // @Description This endpoint allows an authenticated benefactor to add a new address to their account.
// @Tags Address // @Tags Benefactors Addresses
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body param.BenefactorAddAddressRequest true "New address details" // @Param Request body param.BenefactorAddAddressRequest true "New address details"
// @Success 201 {object} param.BenefactorAddAddressResponse // @Success 201 {object} param.BenefactorAddAddressResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /address/ [post]. // @Router /benefactors/addresses [post].
func (h Handler) AddAddress(c echo.Context) error { func (h Handler) AddAddress(c echo.Context) error {
req := param.BenefactorAddAddressRequest{} req := param.BenefactorAddAddressRequest{}
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -12,12 +12,12 @@ import (
// DeleteAddress godoc // DeleteAddress godoc
// @Summary Delete address by benefactor // @Summary Delete address by benefactor
// @Description This endpoint is used to delete an 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" // @Param id path int true "Address ID"
// @Success 204 // @Success 204
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /address/{id} [delete]. // @Router /benefactors/addresses/{id} [delete].
func (h Handler) DeleteAddress(c echo.Context) error { func (h Handler) DeleteAddress(c echo.Context) error {
var req param.DeleteAddressRequest var req param.DeleteAddressRequest

View File

@ -11,14 +11,14 @@ import (
// GetAddress godoc // GetAddress godoc
// @Summary Get a benefactor address // @Summary Get a benefactor address
// @Tags Address // @Tags Benefactors Addresses
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Address ID" // @Param id path int true "Address ID"
// @Success 200 {object} param.GetAddressResponse // @Success 200 {object} param.GetAddressResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /address/{id} [get]. // @Router /benefactors/addresses/{id} [get].
func (h Handler) GetAddress(c echo.Context) error { func (h Handler) GetAddress(c echo.Context) error {
var req param.GetAddressRequest var req param.GetAddressRequest
if bErr := echo.PathParamsBinder(c).Uint("id", &req.AddressID).BindError(); bErr != nil { if bErr := echo.PathParamsBinder(c).Uint("id", &req.AddressID).BindError(); bErr != nil {

View File

@ -11,13 +11,13 @@ import (
// GetAddresses godoc // GetAddresses godoc
// @Summary Get all benefactor addresses // @Summary Get all benefactor addresses
// @Tags Address // @Tags Benefactors Addresses
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} param.GetAllAddressesResponse // @Success 200 {object} param.GetAllAddressesResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /address/ [get]. // @Router /benefactors/addresses [get].
func (h Handler) GetAddresses(c echo.Context) error { func (h Handler) GetAddresses(c echo.Context) error {
var req param.GetAllAddressesRequest var req param.GetAllAddressesRequest

View File

@ -10,12 +10,12 @@ import (
// GetAllCities godoc // GetAllCities godoc
// @Summary Get all cities // @Summary Get all cities
// @Tags Address // @Tags Benefactors Addresses
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} addressparam.GetAllCitiesResponse // @Success 200 {object} addressparam.GetAllCitiesResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Router /address/cities [get]. // @Router /benefactors/addresses/cities [get].
func (h Handler) GetAllCities(c echo.Context) error { func (h Handler) GetAllCities(c echo.Context) error {
var req addressparam.GetAllCitiesRequest var req addressparam.GetAllCitiesRequest

View File

@ -10,12 +10,12 @@ import (
// GetAllProvinces godoc // GetAllProvinces godoc
// @Summary Get all provinces // @Summary Get all provinces
// @Tags Address // @Tags Benefactors Addresses
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} addressparam.GetAllProvincesResponse // @Success 200 {object} addressparam.GetAllProvincesResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Router /address/provinces [get]. // @Router /benefactors/addresses/provinces [get].
func (h Handler) GetAllProvinces(c echo.Context) error { func (h Handler) GetAllProvinces(c echo.Context) error {
var req addressparam.GetAllProvincesRequest var req addressparam.GetAllProvincesRequest

View File

@ -7,18 +7,18 @@ import (
) )
func (h Handler) SetRoutes(e *echo.Echo) { func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/address") r := e.Group("/benefactors/addresses")
r.GET("/provinces", h.GetAllProvinces) r.GET("/provinces", h.GetAllProvinces)
r.GET("/cities", h.GetAllCities) 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)) middleware.BenefactorAuthorization(entity.UserBenefactorRole))
r.GET("/:id", h.GetAddress, middleware.Auth(h.authSvc), r.GET("/:id", h.GetAddress, middleware.Auth(h.authSvc),
middleware.BenefactorAuthorization(entity.UserBenefactorRole)) middleware.BenefactorAuthorization(entity.UserBenefactorRole))
r.GET("/", h.GetAddresses, middleware.Auth(h.authSvc), r.GET("", h.GetAddresses, middleware.Auth(h.authSvc),
middleware.BenefactorAuthorization(entity.UserBenefactorRole)) middleware.BenefactorAuthorization(entity.UserBenefactorRole))
r.DELETE("/:id", h.DeleteAddress, middleware.Auth(h.authSvc), r.DELETE("/:id", h.DeleteAddress, middleware.Auth(h.authSvc),
middleware.BenefactorAuthorization(entity.UserBenefactorRole)) 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)) middleware.BenefactorAuthorization(entity.UserBenefactorRole))
} }

View File

@ -10,8 +10,8 @@ import (
) )
// UpdateAddress godoc // UpdateAddress godoc
// @Summary Edit benefactor address // @Summary Update benefactor address
// @Tags Address // @Tags Benefactors Addresses
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Address ID" // @Param id path int true "Address ID"
@ -19,7 +19,7 @@ import (
// @Success 204 // @Success 204
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /address/{id} [patch]. // @Router /benefactors/addresses/{id} [put].
func (h Handler) UpdateAddress(c echo.Context) error { func (h Handler) UpdateAddress(c echo.Context) error {
var req param.UpdateAddressRequest var req param.UpdateAddressRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -11,13 +11,13 @@ import (
// loginOrRegister godoc // loginOrRegister godoc
// @Summary Login or register a benefactor // @Summary Login or register a benefactor
// @Description This endpoint is used to authenticate an existing benefactor account or register a new one. // @Description This endpoint is used to authenticate an existing benefactor account or register a new one.
// @Tags Benefactor // @Tags Benefactors
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body benefactoreparam.LoginOrRegisterRequest true "Login or register request details" // @Param Request body benefactoreparam.LoginOrRegisterRequest true "Login or register request details"
// @Success 200 {object} benefactoreparam.LoginOrRegisterResponse // @Success 200 {object} benefactoreparam.LoginOrRegisterResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Router /benefactor/login-register [post]. // @Router /benefactors/login-register [post].
func (h Handler) loginOrRegister(c echo.Context) error { func (h Handler) loginOrRegister(c echo.Context) error {
var req benefactoreparam.LoginOrRegisterRequest var req benefactoreparam.LoginOrRegisterRequest

View File

@ -5,7 +5,7 @@ import (
) )
func (h Handler) SetRoutes(e *echo.Echo) { func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/benefactor") r := e.Group("/benefactors")
r.POST("/send-otp", h.SendOtp) r.POST("/send-otp", h.SendOtp)
r.POST("/login-register", h.loginOrRegister) r.POST("/login-register", h.loginOrRegister)

View File

@ -11,13 +11,13 @@ import (
// SendOtp godoc // SendOtp godoc
// @Summary Send OTP to benefactor // @Summary Send OTP to benefactor
// @Description This endpoint sends an OTP to the benefactor's phone number for verification purposes. // @Description This endpoint sends an OTP to the benefactor's phone number for verification purposes.
// @Tags Benefactor // @Tags Benefactors
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body benefactoreparam.SendOtpRequest true "Send OTP request details" // @Param Request body benefactoreparam.SendOtpRequest true "Send OTP request details"
// @Success 200 {object} benefactoreparam.SendOtpResponse // @Success 200 {object} benefactoreparam.SendOtpResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Router /benefactor/send-otp [post]. // @Router /benefactors/send-otp [post].
func (h Handler) SendOtp(c echo.Context) error { func (h Handler) SendOtp(c echo.Context) error {
var req benefactoreparam.SendOtpRequest var req benefactoreparam.SendOtpRequest

View File

@ -11,14 +11,14 @@ import (
// Get godoc // Get godoc
// @Summary Get a specific kind box for a benefactor // @Summary Get a specific kind box for a benefactor
// @Description This endpoint retrieves a specific kind box associated with an authenticated benefactor. // @Description This endpoint retrieves a specific kind box associated with an authenticated benefactor.
// @Tags KindBox // @Tags Benefactors KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Kind box ID" // @Param id path int true "Kind box ID"
// @Success 200 {object} param.KindBoxGetResponse // @Success 200 {object} param.KindBoxGetResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxes/{id} [get]. // @Router /benefactors/kindboxes/{id} [get].
func (h Handler) Get(c echo.Context) error { func (h Handler) Get(c echo.Context) error {
var req param.KindBoxGetRequest var req param.KindBoxGetRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -13,7 +13,7 @@ import (
// GetAll godoc // GetAll godoc
// @Summary Get all KindBoxes by benefactor // @Summary Get all KindBoxes by benefactor
// @Description Retrieves a list of all KindBoxes with filtering, sorting, and pagination options // @Description Retrieves a list of all KindBoxes with filtering, sorting, and pagination options
// @Tags KindBox // @Tags Benefactors KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param filter_id query int false "Filter by ID" // @Param filter_id query int false "Filter by ID"
@ -40,7 +40,7 @@ import (
// @Success 200 {object} param.KindBoxGetAllResponse // @Success 200 {object} param.KindBoxGetAllResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxes [get]. // @Router /benefactors/kindboxes [get].
func (h Handler) GetAll(c echo.Context) error { func (h Handler) GetAll(c echo.Context) error {
var req param.KindBoxGetAllRequest var req param.KindBoxGetAllRequest

View File

@ -12,7 +12,7 @@ import (
// RegisterEmptyingRequest godoc // RegisterEmptyingRequest godoc
// @Summary Register a new emptying request for a kind box by benefactor // @Summary Register a new emptying request for a kind box by benefactor
// @Tags Benefactor // @Tags Benefactors KindBoxes
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBox ID" // @Param id path int true "KindBox ID"
@ -20,7 +20,7 @@ import (
// @Success 204 {string} "No content" // @Success 204 {string} "No content"
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxes/{id}/emptying-requests [patch]. // @Router /benefactors/kindboxes/{id}/emptying-requests [patch].
func (h Handler) RegisterEmptyingRequest(c echo.Context) error { func (h Handler) RegisterEmptyingRequest(c echo.Context) error {
var req param.KindBoxRegisterEmptyingRequest var req param.KindBoxRegisterEmptyingRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

View File

@ -7,7 +7,7 @@ import (
) )
func (h Handler) SetRoutes(e *echo.Echo) { func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/benefactor/kindboxes") r := e.Group("/benefactors/kindboxes")
r.Use( r.Use(
middleware.Auth(h.authSvc), middleware.Auth(h.authSvc),

View File

@ -13,14 +13,14 @@ import (
// Add godoc // Add godoc
// @Summary Add a new kind box request for a benefactor // @Summary Add a new kind box request for a benefactor
// @Tags KindBoxReq // @Tags Benefactors KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Request body param.KindBoxReqAddRequest true "New kind box request details" // @Param Request body param.KindBoxReqAddRequest true "New kind box request details"
// @Success 200 {object} param.KindBoxReqAddResponse // @Success 200 {object} param.KindBoxReqAddResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxreqs/ [post]. // @Router /benefactors/kindboxreqs [post].
func (h Handler) Add(c echo.Context) error { func (h Handler) Add(c echo.Context) error {
req := param.KindBoxReqAddRequest{} req := param.KindBoxReqAddRequest{}
if err := c.Bind(&req); err != nil { if err := c.Bind(&req); err != nil {

View File

@ -9,17 +9,17 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
// delete godoc // Delete godoc
// @Summary delete kindboxreq by benefactor // @Summary Delete kindboxreq by benefactor
// @Description This endpoint is used to delete benefactor's kindboxreq at pending status // @Description This endpoint is used to delete benefactor's kindboxreq at pending status
// @Tags KindBoxReq // @Tags Benefactors KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Kind box request ID" // @Param id path int true "Kind box request ID"
// @Success 200 {object} param.KindBoxReqDeleteResponse // @Success 200 {object} param.KindBoxReqDeleteResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxreqs/{id} [delete]. // @Router /benefactors/kindboxreqs/{id} [delete].
func (h Handler) Delete(c echo.Context) error { func (h Handler) Delete(c echo.Context) error {
req := param.KindBoxReqDeleteRequest{} req := param.KindBoxReqDeleteRequest{}
if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil {

View File

@ -11,14 +11,14 @@ import (
// Get godoc // Get godoc
// @Summary Get a kind box request for a benefactor // @Summary Get a kind box request for a benefactor
// @Tags KindBoxReq // @Tags Benefactors KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Kind box request ID" // @Param id path int true "Kind box request ID"
// @Success 200 {object} param.KindBoxReqGetResponse // @Success 200 {object} param.KindBoxReqGetResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxreqs/{id} [get]. // @Router /benefactors/kindboxreqs/{id} [get].
func (h Handler) Get(c echo.Context) error { func (h Handler) Get(c echo.Context) error {
var req param.KindBoxReqGetRequest var req param.KindBoxReqGetRequest
if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil {

View File

@ -13,7 +13,7 @@ import (
// GetAll godoc // GetAll godoc
// @Summary Get all KindBox requests // @Summary Get all KindBox requests
// @Description Retrieves a list of all KindBox requests with filtering, sorting, and pagination options // @Description Retrieves a list of all KindBox requests with filtering, sorting, and pagination options
// @Tags KindBoxReq // @Tags Benefactors KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param filter_id query int false "Filter by ID" // @Param filter_id query int false "Filter by ID"
@ -32,7 +32,7 @@ import (
// @Success 200 {object} param.GetAllResponse // @Success 200 {object} param.GetAllResponse
// @Failure 400 {string} "Bad request" // @Failure 400 {string} "Bad request"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxreqs/ [get]. // @Router /benefactors/kindboxreqs [get].
func (h Handler) GetAll(c echo.Context) error { func (h Handler) GetAll(c echo.Context) error {
var req param.GetAllRequest var req param.GetAllRequest

View File

@ -7,16 +7,16 @@ import (
) )
func (h Handler) SetRoutes(e *echo.Echo) { func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/benefactor/kindboxreqs") r := e.Group("/benefactors/kindboxreqs")
r.Use( r.Use(
middleware.Auth(h.authSvc), middleware.Auth(h.authSvc),
middleware.BenefactorAuthorization(entity.UserBenefactorRole), middleware.BenefactorAuthorization(entity.UserBenefactorRole),
) )
r.POST("/", h.Add) r.POST("", h.Add)
r.GET("/:id", h.Get) r.GET("/:id", h.Get)
r.DELETE("/:id", h.Delete) r.DELETE("/:id", h.Delete)
r.GET("/", h.GetAll) r.GET("", h.GetAll)
r.PUT("/:id", h.Update) r.PUT("/:id", h.Update)
} }

View File

@ -11,7 +11,7 @@ import (
// Update godoc // Update godoc
// @Summary Update kind box request by benefactor // @Summary Update kind box request by benefactor
// @Tags KindBoxReq // @Tags Benefactors KindBoxReqs
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "KindBoxReq ID" // @Param id path int true "KindBoxReq ID"
@ -23,7 +23,7 @@ import (
// @Failure 422 {object} httpmsg.ErrorResponse // @Failure 422 {object} httpmsg.ErrorResponse
// @Failure 500 {string} "something went wrong" // @Failure 500 {string} "something went wrong"
// @Security AuthBearerBenefactor // @Security AuthBearerBenefactor
// @Router /benefactor/kindboxreqs/{id} [put]. // @Router /benefactors/kindboxreqs/{id} [put].
func (h Handler) Update(c echo.Context) error { func (h Handler) Update(c echo.Context) error {
var req param.KindBoxReqUpdateRequest var req param.KindBoxReqUpdateRequest
if bErr := c.Bind(&req); bErr != nil { if bErr := c.Bind(&req); bErr != nil {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,6 @@ package mysqlkindbox
import ( import (
"context" "context"
"database/sql" "database/sql"
"git.gocasts.ir/ebhomengo/niki/entity" "git.gocasts.ir/ebhomengo/niki/entity"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
querytransaction "git.gocasts.ir/ebhomengo/niki/pkg/query_transaction/sql" querytransaction "git.gocasts.ir/ebhomengo/niki/pkg/query_transaction/sql"