forked from ebhomengo/niki
31 lines
825 B
Go
31 lines
825 B
Go
package benefactoraddresshandler
|
|
|
|
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"
|
|
)
|
|
|
|
// GetAllProvinces godoc
|
|
// @Summary get all provinces
|
|
// @Tags address
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} addressparam.GetAllProvincesResponse
|
|
// @Failure 400 {string} "Bad request"
|
|
// @Router /address/provinces [get]
|
|
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)
|
|
}
|