Skip to content

Commit

Permalink
feat!: CE-718 Allow users to remove file review complete actions (#65)
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitri Korin <dmitri.korin@gov.bc.ca>
Co-authored-by: afwilcox <alecwilcox@gmail.com>
  • Loading branch information
3 people authored Jun 5, 2024
1 parent 8a4f262 commit 8c5668f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
21 changes: 18 additions & 3 deletions backend/src/case_file/case_file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,9 @@ export class CaseFileService {

async updateReview(reviewInput: ReviewInput): Promise<CaseFile> {
try {
const { isReviewRequired, caseIdentifier, reviewComplete, leadIdentifier } = reviewInput;
await this.prisma.$transaction(async (db) => {
const { isReviewRequired, caseIdentifier } = reviewInput;
//update review_required_ind in table case_file
// Update review_required_ind in table case_file
await db.case_file.update({
where: {
case_file_guid: caseIdentifier,
Expand All @@ -778,8 +778,23 @@ export class CaseFileService {
review_required_ind: isReviewRequired,
},
});

// If reviewComplete is provided, update the corresponding action
if (reviewComplete && reviewComplete.actionId) {
const { actionId, activeIndicator } = reviewComplete;

await db.action.update({
where: {
action_guid: actionId,
},
data: {
active_ind: activeIndicator,
},
});
}
});
return reviewInput;

return this.findOneByLeadId(leadIdentifier);
} catch (err) {
this.logger.error(err);
throw new GraphQLError("Error in updateReview", {});
Expand Down
1 change: 1 addition & 0 deletions backend/src/case_file/case_file_inputs.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ input ReviewActionInput {
date: Date!
actionCode: String!
actionId: String
activeIndicator: Boolean
}

input CreateSupplementalNoteInput {
Expand Down
1 change: 1 addition & 0 deletions backend/src/case_file/dto/review-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export class ReviewInput {
date: Date;
actionCode: string;
actionId?: string;
activeIndicator?: boolean;
};
}
1 change: 1 addition & 0 deletions backend/src/case_file_action/case_file_action.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class CaseFileActionService {
action_code: actionCaseCode,
},
},
active_ind: true,
},
select: {
action_guid: true,
Expand Down

0 comments on commit 8c5668f

Please sign in to comment.