Skip to content

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

fix: old providers without selection

Nevo David3f674de4016a
diff --git a/apps/orchestrator/src/activities/post.activity.ts b/apps/orchestrator/src/activities/post.activity.ts
index b7e3e0275..1db29ca7b 100644
--- a/apps/orchestrator/src/activities/post.activity.ts
+++ b/apps/orchestrator/src/activities/post.activity.ts
@@ -288,6 +288,7 @@ export class PostActivity {
return refresh;
} catch (err) {
+ await this._refreshIntegrationService.setBetweenSteps(integration);
return false;
}
}
diff --git a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts
index 6024b921c..bb81ae8c8 100644
--- a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts
@@ -309,6 +309,16 @@ export class IntegrationRepository {
});
}
+ async setBetweenRefreshSteps(id: string) {
+ return this._integration.model.integration.update({
+ where: {
+ id,
+ },
+ data: {
+ inBetweenSteps: true,
+ },
+ });
+ }
refreshNeeded(org: string, id: string) {
return this._integration.model.integration.update({
where: {
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 102f44ca0..0a145eb03 100644
--- a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
@@ -204,6 +204,10 @@ export class IntegrationService {
return this._integrationRepository.refreshNeeded(org, id);
}
+ async setBetweenRefreshSteps(id: string) {
+ return this._integrationRepository.setBetweenRefreshSteps(id);
+ }
+
async refreshTokens() {
const integrations = await this._integrationRepository.needsToBeRefreshed();
for (const integration of integrations) {
diff --git a/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts b/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts
index f40e52812..1966aed85 100644
--- a/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts
+++ b/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts
@@ -42,6 +42,14 @@ export class RefreshIntegrationService {
return refresh;
}
+ public async setBetweenSteps(integration: Integration) {
+ await this._integrationService.setBetweenRefreshSteps(integration.id);
+ await this._integrationService.informAboutRefreshError(
+ integration.organizationId,
+ integration
+ );
+ }
+
private async refreshProcess(
integration: Integration,
socialProvider: SocialProvider
@@ -61,12 +69,18 @@ export class RefreshIntegrationService {
integration
);
- await this._integrationService.disconnectChannel(integration.organizationId, integration);
+ await this._integrationService.disconnectChannel(
+ integration.organizationId,
+ integration
+ );
return false;
}
- if (!socialProvider.reConnect) {
+ if (
+ !socialProvider.reConnect ||
+ integration.rootInternalId === integration.internalId
+ ) {
return refresh;
}