refactor: replace ignored numeric literals with constants
This commit is contained in:
@@ -11,6 +11,9 @@ import type {
|
||||
|
||||
import { PrismaService } from '../../../../prisma/prisma.service';
|
||||
|
||||
const UNCHANGED_REVISION_INCREMENT = 0;
|
||||
const REVISION_INCREMENT = 1;
|
||||
|
||||
export type CatalogQuery = {
|
||||
exactTicker?: boolean;
|
||||
instrumentType: 'bond' | 'share';
|
||||
@@ -205,7 +208,7 @@ export class CatalogDiscoveryRepository {
|
||||
ticker: instrument.ticker ?? null,
|
||||
fetchedAt: now,
|
||||
dataRevision: {
|
||||
increment: isDeepStrictEqual(previous.metadata, metadata) ? 0 : 1,
|
||||
increment: isDeepStrictEqual(previous.metadata, metadata) ? UNCHANGED_REVISION_INCREMENT : REVISION_INCREMENT,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -230,8 +233,8 @@ export class CatalogDiscoveryRepository {
|
||||
previousAlias?.matchedUids,
|
||||
matchedUids,
|
||||
) ?
|
||||
0 :
|
||||
1,
|
||||
UNCHANGED_REVISION_INCREMENT :
|
||||
REVISION_INCREMENT,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -257,7 +260,7 @@ export class CatalogDiscoveryRepository {
|
||||
payload,
|
||||
fetchedAt: now,
|
||||
dataRevision: {
|
||||
increment: isDeepStrictEqual(previous?.payload, payload) ? 0 : 1,
|
||||
increment: isDeepStrictEqual(previous?.payload, payload) ? UNCHANGED_REVISION_INCREMENT : REVISION_INCREMENT,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -390,7 +393,7 @@ export class CatalogDiscoveryRepository {
|
||||
payload,
|
||||
fetchedAt: now,
|
||||
dataRevision: {
|
||||
increment: isDeepStrictEqual(previous?.payload, payload) ? 0 : 1,
|
||||
increment: isDeepStrictEqual(previous?.payload, payload) ? UNCHANGED_REVISION_INCREMENT : REVISION_INCREMENT,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -416,8 +419,8 @@ export class CatalogDiscoveryRepository {
|
||||
previous?.matchedUids,
|
||||
instrumentUids,
|
||||
) ?
|
||||
0 :
|
||||
1,
|
||||
UNCHANGED_REVISION_INCREMENT :
|
||||
REVISION_INCREMENT,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -442,8 +445,8 @@ export class CatalogDiscoveryRepository {
|
||||
previous?.instrumentUids,
|
||||
instrumentUids,
|
||||
) ?
|
||||
0 :
|
||||
1,
|
||||
UNCHANGED_REVISION_INCREMENT :
|
||||
REVISION_INCREMENT,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user