chore: minor re-order of routes/controllers in admin api v3 router/controller

This commit is contained in:
Julian Lam
2023-11-08 14:03:56 -05:00
parent 807d778c77
commit 181a93996c
2 changed files with 21 additions and 21 deletions

View File

@@ -31,25 +31,6 @@ Admin.getAnalyticsData = async (req, res) => {
}));
};
Admin.chats = {};
Admin.chats.deleteRoom = async (req, res) => {
const roomData = await messaging.getRoomData(req.params.roomId);
if (!roomData) {
throw new Error('[[error:no-room]]');
}
await messaging.deleteRooms([req.params.roomId]);
events.log({
type: 'chat-room-deleted',
roomId: req.params.roomId,
roomName: roomData.roomName ? roomData.roomName : `No room name`,
uid: req.uid,
ip: req.ip,
});
helpers.formatApiResponse(200, res);
};
Admin.generateToken = async (req, res) => {
const { uid, description } = req.body;
const token = await api.utils.tokens.generate({ uid, description });
@@ -78,3 +59,22 @@ Admin.deleteToken = async (req, res) => {
const { token } = req.params;
helpers.formatApiResponse(200, res, await api.utils.tokens.delete(token));
};
Admin.chats = {};
Admin.chats.deleteRoom = async (req, res) => {
const roomData = await messaging.getRoomData(req.params.roomId);
if (!roomData) {
throw new Error('[[error:no-room]]');
}
await messaging.deleteRooms([req.params.roomId]);
events.log({
type: 'chat-room-deleted',
roomId: req.params.roomId,
roomName: roomData.roomName ? roomData.roomName : `No room name`,
uid: req.uid,
ip: req.ip,
});
helpers.formatApiResponse(200, res);
};