Files
base/internal/delivery/http/platform/profilerole.go
2026-04-10 18:25:21 +03:30

35 lines
959 B
Go

package platform
import (
"github.com/gin-gonic/gin"
"base/internal/dto"
)
// ListProfileRoles returns the list of profile roles for setup-profile.
// @Summary list profile roles
// @Description returns all profile roles (id, title) for platform - use role_id when calling setup-profile
// @Tags Platform
// @Produce json
// @Success 200 {array} dto.ProfileRole "list of profile roles"
// @Failure 500 {object} dto.ErrorResponse "internal server error"
// @Router /api/v1/platform/profile-roles [get]
func (ctl *Controller) ListProfileRoles(c *gin.Context) {
lg := ctl.logger.With().
Str("module", "platform").
Str("router", "platform").
Str("handler", "ListProfileRoles").
Logger()
roles, err := ctl.profileRoleService.List(c.Request.Context())
if err != nil {
lg.Error().Err(err).Msg("failed to list profile roles")
r := dto.InternalServerError()
c.JSON(r.Status, r)
return
}
r := dto.OK().WithData(roles)
c.JSON(r.Status, r)
}