package comics

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"gitlab.thpeetz.de/kontor/kontor-go/pkg/dao"
	"gitlab.thpeetz.de/kontor/kontor-go/pkg/util"
)

const (
	// ArtistPublisherTemplate defines name of template file for comics publishers
	ArtistPublisherTemplate = "comics/publishers.html"
)

func showArtistList(c *gin.Context) {
	var dao = ArtistDAO{Db: dao.KontorDb}
	if artists, err := dao.FindAll(); err == nil {
		util.Render(c, gin.H{"title": "Comic Artists", "payload": artists}, "artists.html")
	} else {
		c.AbortWithError(http.StatusNotFound, err)
	}
}
