feat(integrations): align notion authorization
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user