Library/routes/api/v1/publishers_list.go

23 lines
456 B
Go
Raw Normal View History

package v1
import (
2018-03-05 11:53:12 +00:00
"git.kolaente.de/konrad/Library/models"
"github.com/labstack/echo"
"net/http"
)
2017-11-08 09:55:17 +00:00
// PublishersList is the handler to list publishers
func PublishersList(c echo.Context) error {
2017-11-29 14:22:25 +00:00
// Prepare the searchterm
search := c.QueryParam("s")
list, err := models.ListPublishers(search)
2017-11-07 15:35:10 +00:00
if err != nil {
2018-01-15 12:20:58 +00:00
return c.JSON(http.StatusInternalServerError, models.Message{"Error getting publishers."})
}
return c.JSON(http.StatusOK, list)
2017-11-07 15:35:10 +00:00
}