2024-08-01 10:20:18 +00:00
|
|
|
package adminagenthandler
|
2024-06-10 14:49:13 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2024-08-01 10:20:18 +00:00
|
|
|
adminagentparam "git.gocasts.ir/ebhomengo/niki/param/admin/agent"
|
2024-06-10 14:49:13 +00:00
|
|
|
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetAllAgent godoc
|
|
|
|
// @Summary Get all agents by admin
|
2024-08-27 17:49:34 +00:00
|
|
|
// @Tags Admins
|
2024-06-10 14:49:13 +00:00
|
|
|
// @Accept json
|
|
|
|
// @Produce json
|
2024-08-01 10:20:18 +00:00
|
|
|
// @Success 200 {object} adminagentparam.GetAllAgentResponse
|
2024-06-10 14:49:13 +00:00
|
|
|
// @Failure 400 {string} "Bad request"
|
|
|
|
// @Security AuthBearerAdmin
|
2024-07-24 23:45:04 +00:00
|
|
|
// @Router /admins/agents [get].
|
2024-06-10 14:49:13 +00:00
|
|
|
func (h Handler) GetAllAgent(c echo.Context) error {
|
2024-08-01 10:20:18 +00:00
|
|
|
var resp adminagentparam.GetAllAgentResponse
|
|
|
|
resp, sErr := h.agentSvc.GetAllAgent(c.Request().Context())
|
2024-06-10 14:49:13 +00:00
|
|
|
if sErr != nil {
|
|
|
|
msg, code := httpmsg.Error(sErr)
|
|
|
|
|
|
|
|
return echo.NewHTTPError(code, msg)
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
|
}
|