feat(integrations): align notion authorization

This commit is contained in:
2026-06-06 18:00:19 +08:00
parent 5ed9952b7e
commit 0f2d64c8f6
9 changed files with 154 additions and 9 deletions
@@ -20,6 +20,23 @@ func NewNotionIntegrationHandler(svc *service.NotionIntegrationService) *NotionI
return &NotionIntegrationHandler{svc: svc}
}
// Authorization creates a Notion OAuth authorization URL.
// POST /api/v1/accounts/:account_id/notion/authorization
func (h *NotionIntegrationHandler) Authorization(c *gin.Context) {
accountID, err := parseUintParam(c, "account_id")
if err != nil {
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid account_id")
return
}
result, svcErr := h.svc.BuildAuthorizationURL(accountID)
if svcErr != nil {
c.JSON(http.StatusUnprocessableEntity, gin.H{"success": false})
return
}
c.JSON(http.StatusOK, result)
}
// Delete removes a Notion integration for an account.
// DELETE /api/v1/accounts/:account_id/integrations/notion
func (h *NotionIntegrationHandler) Delete(c *gin.Context) {