refactor: deprecate socket method posts.getPidIndex

This commit is contained in:
Julian Lam
2023-04-13 16:23:26 -04:00
parent d814e281a0
commit ee9f53f1ff
7 changed files with 71 additions and 32 deletions

View File

@@ -44,6 +44,18 @@ Posts.get = async (req, res) => {
helpers.formatApiResponse(200, res, post);
};
Posts.getIndex = async (req, res) => {
const { pid } = req.params;
const { sort } = req.body;
const index = await api.posts.getIndex(req, { pid, sort });
if (index === null) {
return helpers.formatApiResponse(404, res, new Error('[[error:no-post]]'));
}
helpers.formatApiResponse(200, res, { index });
};
Posts.getSummary = async (req, res) => {
const post = await api.posts.getSummary(req, { pid: req.params.pid });
if (!post) {