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