forked from ebhomengo/niki
1
0
Fork 0

Merge branch 'develop' into stage/ruhollahh01/refactor-stage-deployment-docker-setup

This commit is contained in:
hossein 2024-09-03 05:28:00 +00:00
commit b2d7165ea4
48 changed files with 2320 additions and 2342 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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))
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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))

View File

@ -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 {

View File

@ -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"

View File

@ -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"

View File

@ -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 {

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("", 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
// @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 {

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))
}

View File

@ -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 {

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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 {

View File

@ -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),

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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)
}

View File

@ -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 {

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 (
"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"