Skip to content

Commit 4ef3b23

Browse files
committed
Add validation for existing deal in local db
1 parent 9a4013e commit 4ef3b23

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/jobs/terminate-deal-job.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ export async function trackTerminateDealJob() {
4040
deal.dealId,
4141
);
4242

43+
const checkDealInDb = await prismaClient.porep_market_deal.findUnique({
44+
where: {
45+
dealId: deal.dealId,
46+
allocationsCount: clientAllocationIds.length,
47+
provider: deal.provider,
48+
client: deal.client,
49+
railTerminated: false,
50+
},
51+
});
52+
53+
if (checkDealInDb) {
54+
claimTrackingLogger.info(
55+
`Deal ${deal.dealId} already exists in database with matching allocation count, skipping...`,
56+
);
57+
continue;
58+
}
59+
4360
// get the deal time frame based on all allocations and count of allocations for the deal
4461
const allocationInfo =
4562
await dmobPrismaClient.unified_verified_deal.aggregate({

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"skipLibCheck": true,
1010
"outDir": "./dist",
1111
"inlineSourceMap": true,
12-
// "baseUrl": "./",
1312
"strictPropertyInitialization": false
1413
},
1514
"include": ["src/**/*"],

0 commit comments

Comments
 (0)