package v1 import ( "net/http" "github.com/gin-gonic/gin" "github.com/gochat/gochat/internal/service" "github.com/gochat/gochat/pkg/response" ) // NotionIntegrationHandler handles Notion integration endpoints. // Reference: Chatwoot Integrations::NotionController type NotionIntegrationHandler struct { svc *service.NotionIntegrationService } // NewNotionIntegrationHandler creates a new NotionIntegrationHandler. func NewNotionIntegrationHandler(svc *service.NotionIntegrationService) *NotionIntegrationHandler { return &NotionIntegrationHandler{svc: svc} } // Delete removes a Notion integration for an account. // DELETE /api/v1/accounts/:account_id/integrations/notion func (h *NotionIntegrationHandler) Delete(c *gin.Context) { accountID, err := parseUintParam(c, "account_id") if err != nil { response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid account_id") return } if svcErr := h.svc.Delete(c.Request.Context(), accountID); svcErr != nil { handleServiceError(c, svcErr) return } response.OK(c, gin.H{"message": "Notion integration deleted"}) } // RegisterNotionIntegrationRoutes registers Notion integration routes. func RegisterNotionIntegrationRoutes(g *gin.RouterGroup, h *NotionIntegrationHandler) { notion := g.Group("/notion") { notion.DELETE("/", h.Delete) } }