tsc
This commit is contained in:
@@ -89,13 +89,14 @@ router.post(
|
|||||||
|
|
||||||
const comment = await Comment.findByPk(id, {
|
const comment = await Comment.findByPk(id, {
|
||||||
transaction,
|
transaction,
|
||||||
|
rejectOnEmpty: true,
|
||||||
lock: {
|
lock: {
|
||||||
level: transaction.LOCK.UPDATE,
|
level: transaction.LOCK.UPDATE,
|
||||||
of: Comment,
|
of: Comment,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const document = await Document.findByPk(comment.documentId, {
|
const document = await Document.findByPk(comment.documentId, {
|
||||||
userId: user.id
|
userId: user.id,
|
||||||
});
|
});
|
||||||
authorize(user, "comment", document);
|
authorize(user, "comment", document);
|
||||||
authorize(user, "update", comment);
|
authorize(user, "update", comment);
|
||||||
@@ -127,9 +128,10 @@ router.post(
|
|||||||
|
|
||||||
const comment = await Comment.findByPk(id, {
|
const comment = await Comment.findByPk(id, {
|
||||||
transaction,
|
transaction,
|
||||||
|
rejectOnEmpty: true,
|
||||||
});
|
});
|
||||||
const document = await Document.findByPk(comment.documentId, {
|
const document = await Document.findByPk(comment.documentId, {
|
||||||
userId: user.id
|
userId: user.id,
|
||||||
});
|
});
|
||||||
authorize(user, "comment", document);
|
authorize(user, "comment", document);
|
||||||
authorize(user, "delete", comment);
|
authorize(user, "delete", comment);
|
||||||
|
|||||||
Reference in New Issue
Block a user