WIP: Export Kontor DB
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s

This commit is contained in:
Thomas Peetz
2026-10-01 17:40:17 +02:00
parent f5abb44466
commit 4aaf580735
47 changed files with 1101 additions and 369 deletions
+30
View File
@@ -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 ProfileHandler struct {
Service *service.ProfileService
}
func NewProfileHandler(db *gorm.DB) *ProfileHandler {
handler := &ProfileHandler{Service: service.NewProfileService(repository.NewProfileRepository(db))}
return handler
}
func (handler *ProfileHandler) List(c *gin.Context) {
profiles, err := handler.Service.List(c.Request.Context())
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
dtos := models.ConvertProfilesToDtos(profiles)
c.JSON(http.StatusOK, dtos)
}