feat: Add missing comments.info endpoint, fix misnamed types
This commit is contained in:
@@ -55,13 +55,34 @@ router.post(
|
||||
}
|
||||
);
|
||||
|
||||
router.post(
|
||||
"comments.info",
|
||||
auth(),
|
||||
checkCommentingEnabled(),
|
||||
validate(T.CommentsInfoSchema),
|
||||
async (ctx: APIContext<T.CommentsInfoReq>) => {
|
||||
const { id } = ctx.input.body;
|
||||
const { user } = ctx.state.auth;
|
||||
|
||||
const comment = await Comment.findByPk(id, {
|
||||
rejectOnEmpty: true,
|
||||
});
|
||||
authorize(user, "read", comment);
|
||||
|
||||
ctx.body = {
|
||||
data: presentComment(comment),
|
||||
policies: presentPolicies(user, [comment]),
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
router.post(
|
||||
"comments.list",
|
||||
auth(),
|
||||
pagination(),
|
||||
checkCommentingEnabled(),
|
||||
validate(T.CollectionsListSchema),
|
||||
async (ctx: APIContext<T.CollectionsListReq>) => {
|
||||
validate(T.CommentsListSchema),
|
||||
async (ctx: APIContext<T.CommentsListReq>) => {
|
||||
const { sort, direction, documentId, collectionId } = ctx.input.body;
|
||||
const { user } = ctx.state.auth;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user