6446 improve information banner component to make it scale better (#6545)

Closes #6446
This commit is contained in:
bosiraphael
2024-08-05 16:00:52 +02:00
committed by GitHub
parent fa738ec373
commit 2073d8e6e1
16 changed files with 192 additions and 96 deletions

View File

@ -2,25 +2,41 @@ import { Injectable } from '@nestjs/common';
import { UserVarsService } from 'src/engine/core-modules/user/user-vars/services/user-vars.service';
import {
ConnectedAccountKeys,
ConnectedAccountKeyValueType,
} from 'src/modules/connected-account/types/connected-account-key-value.type';
AccountsToReconnectKeyValueType,
AccountsToReconnectKeys,
} from 'src/modules/connected-account/types/accounts-to-reconnect-key-value.type';
@Injectable()
export class AccountsToReconnectService {
constructor(
private readonly userVarsService: UserVarsService<ConnectedAccountKeyValueType>,
private readonly userVarsService: UserVarsService<AccountsToReconnectKeyValueType>,
) {}
public async removeAccountToReconnect(
userId: string,
workspaceId: string,
connectedAccountId: string,
) {
for (const key of Object.values(AccountsToReconnectKeys)) {
await this.removeAccountToReconnectByKey(
key,
userId,
workspaceId,
connectedAccountId,
);
}
}
private async removeAccountToReconnectByKey(
key: AccountsToReconnectKeys,
userId: string,
workspaceId: string,
connectedAccountId: string,
) {
const accountsToReconnect = await this.userVarsService.get({
userId,
workspaceId,
key: ConnectedAccountKeys.ACCOUNTS_TO_RECONNECT,
key,
});
if (!accountsToReconnect) {
@ -35,7 +51,7 @@ export class AccountsToReconnectService {
await this.userVarsService.delete({
userId,
workspaceId,
key: ConnectedAccountKeys.ACCOUNTS_TO_RECONNECT,
key,
});
return;
@ -44,7 +60,7 @@ export class AccountsToReconnectService {
await this.userVarsService.set({
userId,
workspaceId,
key: ConnectedAccountKeys.ACCOUNTS_TO_RECONNECT,
key,
value: updatedAccountsToReconnect,
});
}