Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(permissions): look up the refreshed channel by internalId in the channel limit check

Gilad Resisi326719b33859
diff --git a/apps/backend/src/services/auth/permissions/permissions.service.ts b/apps/backend/src/services/auth/permissions/permissions.service.ts
index 75223fbbf..173368ea9 100644
--- a/apps/backend/src/services/auth/permissions/permissions.service.ts
+++ b/apps/backend/src/services/auth/permissions/permissions.service.ts
@@ -70,7 +70,7 @@ export class PermissionsService {
// but only if the channel actually belongs to this org
if (refreshChannelId) {
const existingIntegration =
- await this._integrationService.getIntegrationById(
+ await this._integrationService.getIntegrationByInternalId(
orgId,
refreshChannelId
);
diff --git a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
index be87d0006..992121fa6 100644
--- a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
@@ -179,6 +179,13 @@ export class IntegrationService {
return this._integrationRepository.getIntegrationById(org, id);
}
+ getIntegrationByInternalId(org: string, internalId: string) {
+ return this._integrationRepository.getIntegrationByInternalId(
+ org,
+ internalId
+ );
+ }
+
async refreshToken(provider: SocialProvider, refresh: string) {
try {
const { refreshToken, accessToken, expiresIn } =