Skip to content

Commit a58f95c

Browse files
committed
feat: add reviewer email to push authorise endpoint
1 parent efe59f5 commit a58f95c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/service/routes/push.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,22 @@ router.post('/:id/authorise', async (req: Request, res: Response) => {
128128
if (isAllowed) {
129129
console.log(`user ${username} approved push request for ${id}`);
130130

131+
const reviewerList = await db.getUsers({ username });
132+
const reviewerEmail = reviewerList[0].email;
133+
134+
if (!reviewerEmail) {
135+
res.status(401).send({
136+
message: `There was no registered email address for the reviewer: ${username}`,
137+
});
138+
return;
139+
}
140+
131141
const attestation = {
132142
questions,
133143
timestamp: new Date(),
134144
reviewer: {
135145
username,
146+
reviewerEmail,
136147
},
137148
};
138149
const result = await db.authorise(id, attestation);

0 commit comments

Comments
 (0)