refactor: migrate posts.getReplies to write API

This commit is contained in:
Julian Lam
2023-04-17 14:15:20 -04:00
parent ee9f53f1ff
commit 69b409385d
6 changed files with 272 additions and 12 deletions

View File

@@ -160,3 +160,12 @@ Posts.deleteDiff = async (req, res) => {
helpers.formatApiResponse(200, res, await api.posts.getDiffs(req, { ...req.params }));
};
Posts.getReplies = async (req, res) => {
const replies = await api.posts.getReplies(req, { ...req.params });
if (replies === null) {
return helpers.formatApiResponse(404, res, new Error('[[error:no-post]]'));
}
helpers.formatApiResponse(200, res, { replies });
};