Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6382 create a command to add a uservar in the key value pair table for every account which needs to reconnect #6553

Conversation

bosiraphael
Copy link
Contributor

Closes #6382

Create SetUserVarsAccountsToReconnectCommand.
This command loops on all workspaces and:

  • deletes all user vars with deprecated key ACCOUNTS_TO_RECONNECT
  • creates a key value pair of type USER_VAR with a key of ACCOUNTS_TO_RECONNECT_INSUFFICIENT_PERMISSIONS for all connect accounts with a message channel or calendar channel with status FAILED_INSUFFICIENT_PERMISSIONS

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This pull request implements a new command to manage accounts requiring reconnection due to insufficient permissions as part of the upgrade to version 0.23.

  • Added SetUserVarsAccountsToReconnectCommand in /packages/twenty-server/src/database/commands/upgrade-version/0-23/0-23-set-user-vars-accounts-to-reconnect.command.ts to handle account reconnection across workspaces
  • Updated AccountsToReconnectService in /packages/twenty-server/src/modules/connected-account/services/accounts-to-reconnect.service.ts with new method addAccountToReconnectByKey for centralized management
  • Modified CalendarChannelSyncStatusService and MessagingChannelSyncStatusService to use AccountsToReconnectService instead of direct user variable manipulation
  • Updated related modules to include ConnectedAccountModule and remove UserVarsModule, reflecting the shift in account management approach

9 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

Comment on lines 141 to 146
} catch (error) {
this.logger.error(
`Failed to add account to reconnect for workspace ${workspaceId}: ${error.message}`,
);
throw error;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider wrapping the entire loop body in a try-catch to continue processing other accounts if one fails

@@ -52,6 +56,7 @@ import { ViewModule } from 'src/modules/view/view.module';
SetWorkspaceActivationStatusCommand,
UpdateActivitiesCommand,
BackfillNewOnboardingUserVarsCommand,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: UpgradeTo0_23Command is duplicated in providers array

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments @bosiraphael

@bosiraphael bosiraphael requested a review from Weiko August 7, 2024 09:31
@Weiko Weiko merged commit 5a72b94 into main Aug 7, 2024
6 checks passed
@Weiko Weiko deleted the 6382-create-a-command-to-add-a-uservar-in-the-key-value-pair-table-for-every-account-which-needs-to-reconnect branch August 7, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a command to add a userVar in the key value pair table for every account which needs to reconnect
2 participants