Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/api/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export class AdminService {
}
: undefined,
},
include: {
winnings: true,
},
});
}

Expand Down Expand Up @@ -119,6 +122,18 @@ export class AdminService {
},
}),
);

if (payment.installment_number === 1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium
performance
Consider checking if body.description is different from payment.winnings.description before adding an audit entry. This will prevent unnecessary audit entries when the description hasn't actually changed.

transactions.push((tx) =>
this.addAudit(
userId,
winningsId,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high
correctness
Ensure that winningsId and userId are correctly defined and available in this context. If they are undefined or incorrect, it could lead to incorrect audit trail entries.

`Modified payment description from "${payment.winnings.description}" to "${body.description}"`,
body.auditNote,
tx,
),
);
}
}

let paymentStatus = payment.payment_status as PaymentStatus;
Expand Down Expand Up @@ -546,6 +561,7 @@ export class AdminService {
},
},
take: 1000,
orderBy: { created_at: 'desc' },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium
performance
Ensure that the created_at field is indexed in the database to optimize the performance of the orderBy operation, especially since the query takes up to 1000 records.

});

result.data = audits.map((item) => ({
Expand Down