Add scouthub-attivit-be

This commit is contained in:
Lorenzo Sanesi
2026-07-23 19:34:00 +02:00
parent 904cd2ee9b
commit 2ee7d402b6
55 changed files with 9783 additions and 0 deletions
@@ -0,0 +1,18 @@
import { prisma } from '../../src/db/prisma';
// Solo le tabelle "transazionali" popolate dai test: le anagrafiche di base
// seedate una volta sola (stato_attivita, tipo_categoria, tipo_paragrafo,
// branca, periodo_anno, categoria, materiale) restano intatte tra un test e l'altro.
const TABLES_TO_RESET = [
'paragrafo',
'branca_attivita',
'categoria_attivita',
'materiale_attivita',
'periodo_anno_attivita',
'attivita',
];
export async function resetDatabase(): Promise<void> {
const tables = TABLES_TO_RESET.map((table) => `"${table}"`).join(', ');
await prisma.$executeRawUnsafe(`TRUNCATE TABLE ${tables} RESTART IDENTITY CASCADE`);
}