feat: add room management functionality for admins with listing and deletion options
All checks were successful
Build & Push Docker Image / build (push) Successful in 4m12s
All checks were successful
Build & Push Docker Image / build (push) Successful in 4m12s
This commit is contained in:
@@ -362,4 +362,28 @@ router.delete('/oauth', authenticateToken, requireAdmin, async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// ── Room Management (admin only) ────────────────────────────────────────────
|
||||
|
||||
// GET /api/admin/rooms - List all rooms with owner info
|
||||
router.get('/rooms', authenticateToken, requireAdmin, async (req, res) => {
|
||||
try {
|
||||
const db = getDb();
|
||||
const rooms = await db.all(`
|
||||
SELECT r.id, r.uid, r.name, r.user_id, r.max_participants, r.access_code,
|
||||
r.mute_on_join, r.record_meeting, r.guest_access, r.presentation_file,
|
||||
r.created_at, r.updated_at,
|
||||
COALESCE(NULLIF(u.display_name,''), u.name) as owner_name,
|
||||
u.email as owner_email,
|
||||
(SELECT COUNT(*) FROM room_shares rs WHERE rs.room_id = r.id) as share_count
|
||||
FROM rooms r
|
||||
JOIN users u ON r.user_id = u.id
|
||||
ORDER BY r.created_at DESC
|
||||
`);
|
||||
res.json({ rooms });
|
||||
} catch (err) {
|
||||
log.admin.error(`List rooms error: ${err.message}`);
|
||||
res.status(500).json({ error: 'Rooms could not be loaded' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user