Admin: Suche, Filter und Archiv in der Matchliste, Fehler direkt in der Karte
This commit is contained in:
1 parent
c50741e49c
commit
7ae3efef60
9 files changed
+206
-12
No files matched your search
@@ -137,9 +137,18 @@ export function createAdminRouter({ service, manager, config, settings }) {
|
||||
}));
|
||||
|
||||
// Alle Matches mit allen Details (Codes, Verbindungsdaten, Spieler, Veto, Serie, Ereignisse)
|
||||
router.get('/matches', requireAdmin, wrap(async () => {
|
||||
const ids = service.db.prepare('SELECT id FROM matches ORDER BY created_at DESC LIMIT 100').all();
|
||||
return { matches: ids.map(({ id }) => service.snapshot(id, adminViewer(id))), hosts: await manager.hostUsage() };
|
||||
// ?archived=1 liefert das Archiv, sonst alle nicht archivierten Matches
|
||||
router.get('/matches', requireAdmin, wrap(async (req) => {
|
||||
const archived = req.query.archived === '1';
|
||||
const ids = service.db.prepare(archived
|
||||
? 'SELECT id FROM matches WHERE archived_at IS NOT NULL ORDER BY archived_at DESC LIMIT 300'
|
||||
: 'SELECT id FROM matches WHERE archived_at IS NULL ORDER BY created_at DESC LIMIT 150').all();
|
||||
const archivedCount = service.db.prepare('SELECT COUNT(*) AS n FROM matches WHERE archived_at IS NOT NULL').get().n;
|
||||
return {
|
||||
matches: ids.map(({ id }) => service.snapshot(id, adminViewer(id))),
|
||||
archivedCount,
|
||||
hosts: await manager.hostUsage(),
|
||||
};
|
||||
}));
|
||||
|
||||
const action = (path, fn) => router.post(`/matches/:id/${path}`, requireAdmin, wrap((req) => {
|
||||
@@ -152,6 +161,8 @@ export function createAdminRouter({ service, manager, config, settings }) {
|
||||
action('server/stop', (v) => manager.stopByOrganizer(v));
|
||||
action('server/retry', (v) => manager.retry(v));
|
||||
action('server/warmup-end', (v) => manager.endWarmup(v));
|
||||
action('archive', (v) => service.setArchived(v.matchId, true));
|
||||
action('unarchive', (v) => service.setArchived(v.matchId, false));
|
||||
action('server/pause', (v) => manager.setPaused(v, true));
|
||||
action('server/resume', (v) => manager.setPaused(v, false));
|
||||
action('series/next', (v) => manager.loadNextMap(v));
|
||||
|
||||
Reference in new issue
Block a user