refactor(socket.io): deprecate SocketModules.chats.isDnD in favour of api.users.getStatus

This commit is contained in:
Julian Lam
2023-11-13 10:12:04 -05:00
parent c4b4e79b28
commit eebea4df2e
8 changed files with 82 additions and 7 deletions

View File

@@ -66,6 +66,17 @@ Users.changePicture = async (req, res) => {
helpers.formatApiResponse(200, res);
};
Users.getStatus = async (req, res) => {
helpers.formatApiResponse(200, res, await api.users.getStatus(req, { ...req.params }));
};
Users.checkStatus = async (req, res) => {
const { uid, status } = req.params;
const { status: current } = await api.users.getStatus(req, { uid });
helpers.formatApiResponse(current === status ? 200 : 404, res);
};
Users.updateSettings = async (req, res) => {
const settings = await api.users.updateSettings(req, { ...req.body, uid: req.params.uid });
helpers.formatApiResponse(200, res, settings);