Use transaction from middleware for more database queries (#6051)

This commit is contained in:
jannschu
2023-10-21 23:31:14 +02:00
committed by GitHub
parent 5df48b3204
commit 0518cdc6d9
7 changed files with 29 additions and 11 deletions

View File

@@ -103,6 +103,7 @@ router.post(
});
const document = await Document.findByPk(comment.documentId, {
userId: user.id,
transaction,
});
authorize(user, "comment", document);
authorize(user, "update", comment);
@@ -139,6 +140,7 @@ router.post(
});
const document = await Document.findByPk(comment.documentId, {
userId: user.id,
transaction,
});
authorize(user, "comment", document);
authorize(user, "delete", comment);