5507 modify the partial sync cron to work with the new statuses (#5512)
Closes #5507
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user