eat(ausruestung): allow create role to view full list, add Mitglieder pagination, add admin reset for persoenliche Ausruestung
This commit is contained in:
@@ -238,6 +238,21 @@ class CleanupService {
|
||||
logger.info(`Cleanup: truncated buchhaltung_bankkonten (${count} rows) and reset sequence`);
|
||||
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');
|
||||
return { count: rows[0].count, deleted: false };
|
||||
}
|
||||
const { rows } = await pool.query('SELECT COUNT(*)::int AS count FROM persoenliche_ausruestung');
|
||||
const count = rows[0].count;
|
||||
// Clear FK references from request positions before truncating
|
||||
await pool.query(`UPDATE ausruestung_anfrage_positionen SET zuweisung_persoenlich_id = NULL, zuweisung_typ = 'keine' WHERE zuweisung_persoenlich_id IS NOT NULL`);
|
||||
// CASCADE removes persoenliche_ausruestung_eigenschaften rows automatically
|
||||
await pool.query('TRUNCATE persoenliche_ausruestung CASCADE');
|
||||
logger.info(`Cleanup: truncated persoenliche_ausruestung (${count} rows)`);
|
||||
return { count, deleted: true };
|
||||
}
|
||||
}
|
||||
|
||||
export default new CleanupService();
|
||||
|
||||
Reference in New Issue
Block a user