Skip to content

Commit fb18176

Browse files
committed
feat: convert scopes to conflict
1 parent a4a0923 commit fb18176

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

apps/backend/src/api/routes/integrations.controller.ts

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -336,51 +336,6 @@ export class IntegrationsController {
336336
}
337337
}
338338

339-
@Post('/article/:integration/connect')
340-
@CheckPolicies([AuthorizationActions.Create, Sections.CHANNEL])
341-
async connectArticle(
342-
@GetOrgFromRequest() org: Organization,
343-
@Param('integration') integration: string,
344-
@Body() api: ApiKeyDto
345-
) {
346-
if (
347-
!this._integrationManager
348-
.getAllowedArticlesIntegrations()
349-
.includes(integration)
350-
) {
351-
throw new Error('Integration not allowed');
352-
}
353-
354-
if (!api) {
355-
throw new Error('Missing api');
356-
}
357-
358-
const integrationProvider =
359-
this._integrationManager.getArticlesIntegration(integration);
360-
const { id, name, token, picture, username } =
361-
await integrationProvider.authenticate(api.api);
362-
363-
if (!id) {
364-
throw new Error('Invalid api key');
365-
}
366-
367-
return this._integrationService.createOrUpdateIntegration(
368-
undefined,
369-
true,
370-
org.id,
371-
name,
372-
picture,
373-
'article',
374-
String(id),
375-
integration,
376-
token,
377-
'',
378-
undefined,
379-
username,
380-
false
381-
);
382-
}
383-
384339
@Post('/social/:integration/connect')
385340
@CheckPolicies([AuthorizationActions.Create, Sections.CHANNEL])
386341
@UseFilters(new NotEnoughScopesFilter())

libraries/nestjs-libraries/src/integrations/integration.missing.scopes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class NotEnoughScopesFilter implements ExceptionFilter {
1010
const response = ctx.getResponse<Response>();
1111

1212
response
13-
.status(HttpStatusCode.NotAcceptable)
13+
.status(HttpStatusCode.Conflict)
1414
.json({ msg: exception.message });
1515
}
1616
}

0 commit comments

Comments
 (0)