Skip to content

Commit

Permalink
Update file review func
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarlett-Truong committed Apr 3, 2024
1 parent 25d7046 commit 4c6b824
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions backend/src/case_file/case_file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ export class CaseFileService {
//Else update review_required_ind
else {
await this.prisma.$transaction(async (db) => {
//update isReviewRequired to true
const caseFile = await db.case_file.update({
where: {
case_file_guid: reviewInput.caseIdentifier
Expand Down Expand Up @@ -699,34 +698,19 @@ export class CaseFileService {

async updateReview(reviewInput: ReviewInput) {
try {
const {
leadIdentifier,
agencyCode,
caseCode,
userId,
isReviewRequired,
caseIdentifier,
reviewComplete,
} = reviewInput;

const { isReviewRequired, caseIdentifier } = reviewInput;
await this.prisma.$transaction(async (db) => {
//update review_required_ind in table case_file
const caseFile = await db.case_file.update({
await db.case_file.update({
where: {
case_file_guid: reviewInput.caseIdentifier
case_file_guid: caseIdentifier
},
data: {
review_required_ind: isReviewRequired
}
});

if (!isReviewRequired || !reviewComplete) {
//remove reviewComplete action in table action if isReviewRequired is false
await db.action.delete({
where: { action_guid: reviewInput.reviewComplete.actionId }
});
}
});
return reviewInput;
}
catch (err) {
console.error(err);
Expand Down

0 comments on commit 4c6b824

Please sign in to comment.