package notifications import ( "net/http" "strconv" "github.com/gin-gonic/gin" "galo/internal/auth" "galo/internal/httpx" ) type Handler struct { svc *Service } func NewHandler(svc *Service) *Handler { return &Handler{svc: svc} } func (h *Handler) List(c *gin.Context) { limit, _ := strconv.Atoi(c.DefaultQuery("limit", "100")) list, err := h.svc.List(c.Request.Context(), auth.UserID(c), limit) if err != nil { httpx.RespondError(c, err) return } c.JSON(http.StatusOK, gin.H{"notifications": list}) } func (h *Handler) MarkRead(c *gin.Context) { if err := h.svc.MarkRead(c.Request.Context(), c.Param("id"), auth.UserID(c)); err != nil { httpx.RespondError(c, err) return } c.Status(http.StatusNoContent) }