Implement swagger
This commit is contained in:
@@ -15,10 +15,18 @@ func NewArtistHandler(repo repository.ArtistRepository) *ArtistHandler {
|
||||
return &ArtistHandler{repo: repo}
|
||||
}
|
||||
|
||||
// GetAll godoc
|
||||
// @Summary List all artists
|
||||
// @Tags artist
|
||||
// @Produce json
|
||||
// @Success 200 {array} map[string]interface{}
|
||||
// @Failure 500 {object} ErrorResponse
|
||||
// @Router /artist/getAll [get]
|
||||
func (handler *ArtistHandler) GetAll(c *gin.Context) {
|
||||
artists, err := handler.repo.GetAll(c.Request.Context())
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, artists)
|
||||
|
||||
Reference in New Issue
Block a user