imc-vibe/backend/internal/api/handlers/logs.go
Christoph Haas 270cee44ff Change Go module path to git.workaround.org
- Update module path from github.com/imc/backend to git.workaround.org/chaas/imc/backend
- Update git remote to use git.workaround.org
2026-03-24 23:50:34 +01:00

34 lines
594 B
Go

package handlers
import (
"net/http"
"strconv"
"git.workaround.org/chaas/imc/backend/internal/mail"
"github.com/gin-gonic/gin"
)
type LogsHandler struct{}
func NewLogsHandler() *LogsHandler {
return &LogsHandler{}
}
func (h *LogsHandler) List(c *gin.Context) {
hours := 1
if h := c.Query("hours"); h != "" {
if n, err := strconv.Atoi(h); err == nil && n > 0 {
hours = n
}
}
filter := c.Query("filter")
entries, err := mail.GetLogs(hours, filter)
if err != nil {
Error(c, http.StatusServiceUnavailable, "log service not available")
return
}
Success(c, entries)
}