From f0dd10332c21099d9d9aeae31bbb0a648cd3423e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= Date: Thu, 6 Mar 2025 10:16:40 +0100 Subject: [PATCH] refactor: Update job creation logic to associate payment entity directly and streamline job repository insert --- .../apps/job-launcher/server/src/modules/job/job.service.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.ts index 5101bf4a39..2571479713 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.ts @@ -906,14 +906,12 @@ export class JobService { jobEntity.requestType = requestType; jobEntity.fee = fundTokenFee; // Fee in the token used to funding the escrow jobEntity.fundAmount = fundTokenAmount; // Amount in the token used to funding the escrow + jobEntity.payments = [paymentEntity]; jobEntity.token = dto.escrowFundToken; jobEntity.status = JobStatus.PAID; jobEntity.waitUntil = new Date(); - jobEntity = await this.jobRepository.createUnique(jobEntity); - - paymentEntity.jobId = jobEntity.id; - await this.paymentRepository.updateOne(paymentEntity); + jobEntity = await this.jobRepository.updateOne(jobEntity); return jobEntity.id; }