package handlers import ( "net/http" "github.com/dusiburg/kotosoft-id/internal/services" "github.com/gin-gonic/gin" ) type ConsentHandler struct { svc *services.Service } func NewConsentHandler(svc *services.Service) *ConsentHandler { return &ConsentHandler{svc: svc} } func (h *ConsentHandler) GetUserConsents(c *gin.Context) { userID := mustUserID(c) consents, err := h.svc.GetUserConsents(c.Request.Context(), userID) if err != nil { c.Error(err) return } c.JSON(http.StatusOK, consents) } func (h *ConsentHandler) RevokeAppAccess(c *gin.Context) { userID := mustUserID(c) clientID := c.Param("clientId") if err := h.svc.RevokeConsent(c.Request.Context(), userID, clientID); err != nil { c.Error(err) return } c.Status(http.StatusNoContent) }