kontor-echo: setup project to show homepage
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
Gitea Actions Demo / build-and-test (push) Failing after 11s

This commit is contained in:
Thomas Peetz
2026-11-09 17:02:59 +01:00
parent 074abd3c85
commit debdf3d0b0
63 changed files with 2411 additions and 485 deletions
+30
View File
@@ -0,0 +1,30 @@
package handlers
import (
"kontor-api-echo/internal/models"
"kontor-api-echo/internal/repository"
"kontor-api-echo/internal/service"
"net/http"
"github.com/labstack/echo/v5"
"github.com/uptrace/bun"
)
type MailHandler struct {
Service *service.MailService
}
func NewMailHandler(db *bun.DB) *MailHandler {
handler := &MailHandler{Service: service.NewMailService(repository.NewMailRepository(db))}
return handler
}
func (handler *MailHandler) List(c *echo.Context) {
mails, err := handler.Service.List(c.Request().Context())
if err != nil {
c.JSON(http.StatusInternalServerError, map[string]any{"error": err.Error()})
return
}
dtos := models.ConvertMailsToDtos(mails)
c.JSON(http.StatusOK, dtos)
}