Skip to content

Commit

Permalink
refactor: Update job creation logic to associate payment entity direc…
Browse files Browse the repository at this point in the history
…tly and streamline job repository insert
  • Loading branch information
flopez7 committed Mar 6, 2025
1 parent c6ee9e6 commit f0dd103
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f0dd103

Please sign in to comment.