5507 modify the partial sync cron to work with the new statuses (#5512)

Closes #5507
This commit is contained in:
bosiraphael
2024-05-24 18:27:54 +02:00
committed by GitHub
parent 3de5ed3427
commit 87465b13ee
31 changed files with 1185 additions and 115 deletions

View File

@ -254,4 +254,30 @@ export class ConnectedAccountRepository {
transactionManager,
);
}
public async getConnectedAccountOrThrow(
workspaceId: string,
connectedAccountId: string,
): Promise<ObjectRecord<ConnectedAccountWorkspaceEntity>> {
const connectedAccount = await this.getById(
connectedAccountId,
workspaceId,
);
if (!connectedAccount) {
throw new Error(
`Connected account ${connectedAccountId} not found in workspace ${workspaceId}`,
);
}
const refreshToken = connectedAccount.refreshToken;
if (!refreshToken) {
throw new Error(
`No refresh token found for connected account ${connectedAccountId} in workspace ${workspaceId}`,
);
}
return connectedAccount;
}
}