Skip to content

Commit

Permalink
Merge pull request #220 from IABTechLab/jyg-fix-transaction-rollback
Browse files Browse the repository at this point in the history
Update to use transaction handler function instead
  • Loading branch information
jingyi-gao-ttd authored Oct 24, 2023
2 parents 7cc3c46 + 0e4721c commit 676cf9d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/api/services/participantsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ export const updateParticipantAndTypes = async (
status: ParticipantStatus;
}
) => {
const trx = await Participant.startTransaction();
await participant.$query(trx).patch({
name: participantApprovalPartial.name,
siteId: participantApprovalPartial.siteId,
status: participantApprovalPartial.status,
await Participant.transaction(async (trx) => {
await participant.$query(trx).patch({
name: participantApprovalPartial.name,
siteId: participantApprovalPartial.siteId,
status: participantApprovalPartial.status,
});
await updateParticipantAssociatedRequestTypes(participant, participantApprovalPartial, trx);
});
await updateParticipantAssociatedRequestTypes(participant, participantApprovalPartial, trx);
await trx.commit();
};

export const UpdateSharingTypes = async (
Expand Down

0 comments on commit 676cf9d

Please sign in to comment.