imc-vibe/backend/internal/api/handlers/logs.go
Christoph Haas ff52be8adf Rename project from imc-vibe to imc
- Binary name: imc-vibe -> imc
- Go module: github.com/imc-vibe/backend -> github.com/imc/backend
- JWT issuer: imc-vibe -> imc
- UI labels: IMC Vibe -> IMC
- Update all imports and comments
2026-03-24 23:42:37 +01:00

34 lines
580 B
Go

package handlers
import (
"net/http"
"strconv"
"github.com/gin-gonic/gin"
"github.com/imc/backend/internal/mail"
)
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)
}