refactor(socket.io): deprecate SocketModules.sortPublicRooms in favour of api.chats.sortPublicRooms

This commit is contained in:
Julian Lam
2023-11-15 11:41:02 -05:00
parent 2de534fad8
commit 62b7dfd400
8 changed files with 65 additions and 9 deletions

View File

@@ -68,7 +68,6 @@ Categories.setWatchState = async (req, res) => {
} else if (Object.keys(categories.watchStates).includes(state)) {
state = categories.watchStates[state]; // convert to integer for backend processing
} else {
console.log('throwing', cid, uid, state);
throw new Error('[[error:invalid-data]]');
}

View File

@@ -32,6 +32,13 @@ Chats.create = async (req, res) => {
// currently only returns unread count, but open-ended for future additions if warranted.
Chats.getUnread = async (req, res) => helpers.formatApiResponse(200, res, await api.chats.getUnread(req));
Chats.sortPublicRooms = async (req, res) => {
const { roomIds, scores } = req.body;
await api.chats.sortPublicRooms(req, { roomIds, scores });
helpers.formatApiResponse(200, res);
};
Chats.exists = async (req, res) => {
// yes, this is fine. Room existence is checked via middleware :)
helpers.formatApiResponse(200, res);