forked from ebhomengo/niki
29 lines
691 B
Go
29 lines
691 B
Go
package adminhandler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// GetAllAgent godoc
|
|
// @Summary Get all agents by admin
|
|
// @Tags Admin
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} adminserviceparam.GetAllAgentResponse
|
|
// @Failure 400 {string} "Bad request"
|
|
// @Security AuthBearerAdmin
|
|
// @Router /admins/agents [get]
|
|
func (h Handler) GetAllAgent(c echo.Context) error {
|
|
resp, sErr := h.adminSvc.GetAllAgent(c.Request().Context())
|
|
if sErr != nil {
|
|
msg, code := httpmsg.Error(sErr)
|
|
|
|
return echo.NewHTTPError(code, msg)
|
|
}
|
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
}
|