Use transaction from middleware for more database queries (#6051)
This commit is contained in:
@@ -33,6 +33,7 @@ router.post(
|
||||
if (documentId) {
|
||||
const document = await Document.findByPk(documentId, {
|
||||
userId: user.id,
|
||||
transaction,
|
||||
});
|
||||
authorize(user, "star", document);
|
||||
}
|
||||
@@ -40,7 +41,7 @@ router.post(
|
||||
if (collectionId) {
|
||||
const collection = await Collection.scope({
|
||||
method: ["withMembership", user.id],
|
||||
}).findByPk(collectionId);
|
||||
}).findByPk(collectionId, { transaction });
|
||||
authorize(user, "star", collection);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user