refactor: replace ignored numeric literals with constants
This commit is contained in:
@@ -13,6 +13,10 @@ import { supportedTbankAccounts } from './tbank-account.policy';
|
||||
import { tbankSourceNeedsRefresh } from './tbank-source.policy';
|
||||
import { TbankTokenService } from './tbank-token.service';
|
||||
|
||||
const EXPECTED_UPDATED_CONNECTIONS = 1;
|
||||
const MEMBERSHIP_REVISION_INCREMENT = 1;
|
||||
const UNCHANGED_MEMBERSHIP_REVISION_INCREMENT = 0;
|
||||
|
||||
export type TbankSyncAttempt = {
|
||||
attemptId: string;
|
||||
id: string;
|
||||
@@ -101,7 +105,7 @@ export class TbankAccessService {
|
||||
},
|
||||
data: { state: 'failed', errorCode: 'TBANK_UNAVAILABLE' },
|
||||
});
|
||||
return result.count === 1;
|
||||
return result.count === EXPECTED_UPDATED_CONNECTIONS;
|
||||
}
|
||||
|
||||
async tokenForAttempt(attempt: TbankSyncAttempt): Promise<null | string> {
|
||||
@@ -184,7 +188,7 @@ export class TbankAccessService {
|
||||
where: { userId_revision: { userId, revision } },
|
||||
data: {
|
||||
membershipAt: fetchedAt,
|
||||
membershipRevision: { increment: changed ? 1 : 0 },
|
||||
membershipRevision: { increment: changed ? MEMBERSHIP_REVISION_INCREMENT : UNCHANGED_MEMBERSHIP_REVISION_INCREMENT },
|
||||
},
|
||||
});
|
||||
if (completeWork) {
|
||||
|
||||
Reference in New Issue
Block a user