feat(admin): add reset-atemschutz option to data management tab

This commit is contained in:
Matthias Hochmeister
2026-04-19 17:43:48 +02:00
parent 3f92156115
commit 8c25cb0d40
3 changed files with 18 additions and 0 deletions

View File

@@ -239,6 +239,18 @@ class CleanupService {
return { count, deleted: true };
}
async resetAtemschutz(confirm: boolean): Promise<CleanupResult> {
if (!confirm) {
const { rows } = await pool.query('SELECT COUNT(*)::int AS count FROM atemschutz_traeger');
return { count: rows[0].count, deleted: false };
}
const { rows } = await pool.query('SELECT COUNT(*)::int AS count FROM atemschutz_traeger');
const count = rows[0].count;
await pool.query('TRUNCATE atemschutz_traeger CASCADE');
logger.info(`Cleanup: truncated atemschutz_traeger (${count} rows)`);
return { count, deleted: true };
}
async resetPersoenlicheAusruestung(confirm: boolean): Promise<CleanupResult> {
if (!confirm) {
const { rows } = await pool.query('SELECT COUNT(*)::int AS count FROM persoenliche_ausruestung WHERE geloescht_am IS NULL');