refactor(api): post move to write API

This commit is contained in:
Julian Lam
2021-01-18 15:31:14 -05:00
parent 0fa4c11ea6
commit 966c4117ec
9 changed files with 93 additions and 43 deletions

View File

@@ -38,6 +38,14 @@ Posts.delete = async (req, res) => {
helpers.formatApiResponse(200, res);
};
Posts.move = async (req, res) => {
await api.posts.move(req, {
pid: req.params.pid,
tid: req.body.tid,
});
helpers.formatApiResponse(200, res);
};
async function mock(req) {
const tid = await posts.getPostField(req.params.pid, 'tid');
return { pid: req.params.pid, room_id: `topic_${tid}` };