add missing models
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s

This commit is contained in:
2026-10-04 01:56:25 +02:00
parent ea648082be
commit d9007ba0e4
28 changed files with 927 additions and 105 deletions
@@ -0,0 +1,30 @@
package handlers
import (
"kontor-api-gin/internal/models"
"kontor-api-gin/internal/repository"
"kontor-api-gin/internal/service"
"net/http"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
type BookAuthorHandler struct {
Service *service.BookAuthorService
}
func NewBookAuthorHandler(db *gorm.DB) *BookAuthorHandler {
handler := &BookAuthorHandler{Service: service.NewBookAuthorService(repository.NewBookAuthorRepository(db))}
return handler
}
func (handler *BookAuthorHandler) List(c *gin.Context) {
authors, err := handler.Service.List(c.Request.Context())
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
dtos := models.ConvertBookAuthorsToDtos(authors)
c.JSON(http.StatusOK, dtos)
}