Skip to content

Commit b3fe9ca

Browse files
committed
fix reviewPageService to use curly braces for if blocks
1 parent 4b3d6e7 commit b3fe9ca

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

backend/typescript/services/implementations/reviewPageService.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ class ReviewPageService implements IReviewPageService {
7676
where: { id: applicantRecordId },
7777
attributes: { exclude: ["createdAt", "updatedAt"] },
7878
});
79-
if (!applicantRecord)
79+
if (!applicantRecord) {
8080
throw new Error(`Database integrity has been violated`);
81+
}
8182

8283
const applicant: Applicant | null = await Applicant.findOne({
8384
where: { id: applicantRecord.applicantId },
@@ -89,7 +90,9 @@ class ReviewPageService implements IReviewPageService {
8990
},
9091
],
9192
});
92-
if (!applicant) throw new Error(`Database integrity has been violated`);
93+
if (!applicant) {
94+
throw new Error(`Database integrity has been violated`);
95+
}
9396

9497
return toApplicationDTO(applicant);
9598
} catch (error: unknown) {
@@ -124,8 +127,12 @@ class ReviewPageService implements IReviewPageService {
124127
},
125128
],
126129
});
127-
if (!user) throw new Error(`No user with ${userId} found.`);
128-
if (!user.reviewedApplicantRecords) return [];
130+
if (!user) {
131+
throw new Error(`No user with ${userId} found.`);
132+
}
133+
if (!user.reviewedApplicantRecords) {
134+
return [];
135+
}
129136
return user.reviewedApplicantRecords.map(toReviewedApplicantsDTO);
130137
} catch (error: unknown) {
131138
Logger.error(`Failed to fetch. Reason = ${getErrorMessage(error)}`);
@@ -142,10 +149,11 @@ class ReviewPageService implements IReviewPageService {
142149
await ReviewedApplicantRecord.findOne({
143150
where: { applicantRecordId, reviewerId },
144151
});
145-
if (!reviewedApplicantRecord)
152+
if (!reviewedApplicantRecord) {
146153
throw new Error(
147154
`No reviewed applicant record with ${applicantRecordId} and ${reviewerId} found.`,
148155
);
156+
}
149157
reviewedApplicantRecord.reviewerHasConflict = true;
150158
await reviewedApplicantRecord.save();
151159
return toReviewedApplicantRecordDTO(reviewedApplicantRecord);

0 commit comments

Comments
 (0)