mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-09-04 03:43:31 +02:00
chore: minor re-order of routes/controllers in admin api v3 router/controller
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user