2024-01-22 14:41:55 +00:00
|
|
|
package benefactoraddresshandler
|
2024-01-17 20:17:06 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
addressparam "git.gocasts.ir/ebhomengo/niki/param/benefactor/address"
|
|
|
|
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
)
|
|
|
|
|
2024-05-14 13:07:09 +00:00
|
|
|
// GetAllProvinces godoc
|
2024-05-17 20:16:28 +00:00
|
|
|
// @Summary Get all provinces
|
2024-08-27 17:49:34 +00:00
|
|
|
// @Tags Benefactors Addresses
|
2024-05-14 13:07:09 +00:00
|
|
|
// @Accept json
|
|
|
|
// @Produce json
|
|
|
|
// @Success 200 {object} addressparam.GetAllProvincesResponse
|
|
|
|
// @Failure 400 {string} "Bad request"
|
2024-08-27 17:49:34 +00:00
|
|
|
// @Router /benefactors/addresses/provinces [get].
|
2024-01-17 20:17:06 +00:00
|
|
|
func (h Handler) GetAllProvinces(c echo.Context) error {
|
|
|
|
var req addressparam.GetAllProvincesRequest
|
|
|
|
|
|
|
|
listProvinces, err := h.addressSvc.GetAllProvinces(c.Request().Context(), req)
|
|
|
|
if err != nil {
|
|
|
|
msg, code := httpmsg.Error(err)
|
|
|
|
|
|
|
|
return echo.NewHTTPError(code, msg)
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.JSON(http.StatusOK, listProvinces)
|
|
|
|
}
|