35 lines
885 B
Go
35 lines
885 B
Go
package platform
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"base/internal/dto"
|
|
)
|
|
|
|
// ListSkills returns the list of skills for profile skill selection.
|
|
// @Summary list skills
|
|
// @Description returns all skills from the catalog for profile update skill selection
|
|
// @Tags Platform
|
|
// @Produce json
|
|
// @Success 200 {array} dto.Skill "list of skills"
|
|
// @Failure 500 {object} dto.ErrorResponse "internal server error"
|
|
// @Router /api/v1/platform/skills [get]
|
|
func (ctl *Controller) ListSkills(c *gin.Context) {
|
|
lg := ctl.logger.With().
|
|
Str("module", "platform").
|
|
Str("router", "platform").
|
|
Str("handler", "ListSkills").
|
|
Logger()
|
|
|
|
skills, err := ctl.skillService.List(c.Request.Context())
|
|
if err != nil {
|
|
lg.Error().Err(err).Msg("failed to list skills")
|
|
r := dto.InternalServerError()
|
|
c.JSON(r.Status, r)
|
|
return
|
|
}
|
|
|
|
r := dto.OK().WithData(skills)
|
|
c.JSON(r.Status, r)
|
|
}
|