Refactor financial transaction handling: Consolidate Einnahmen and Ausgaben into Buchung model, update routes and UI components, and add new migration scripts for database schema changes.

This commit is contained in:
hwinkel
2026-03-24 21:06:07 +01:00
parent d582c748a2
commit 1ec15600b5
18 changed files with 928 additions and 358 deletions
+53 -1
View File
@@ -136,8 +136,60 @@ async function main() {
data: { invoiceSequence: 1 },
});
// Seed BuchungKategorien for demo company
const einnahmeKategorien = [
"Fußpflege",
"Privateinlagen",
"Darlehen",
"Steuererstattungen",
"Versicherungserstattungen",
"Zinsertrage",
"Vermietung/Verpachtung",
"Veräußerungserlös",
"Eigenverbrauch",
"Sonstige Einnahmen",
];
const ausgabeKategorien = [
"Waren und Rohstoffe",
"Geringwertige Wirtschaftsgüter",
"Abschreibungen",
"Miete",
"Strom und Wasser",
"Telekommunikation",
"Fortbildung und Messen",
"Beiträge",
"Versicherungen",
"Werbekosten",
"Zinsen",
"Reisekosten",
"Reparaturen und Instandhaltung",
"Bürobedarf",
"Repräsentationskosten",
"Sonstiger Betriebsbedarf",
"Nebenkosten Geldverkehr",
];
for (const name of einnahmeKategorien) {
await prisma.buchungKategorie.upsert({
where: { companyId_name_typ: { companyId: company.id, name, typ: "EINNAHME" } },
update: {},
create: { companyId: company.id, name, typ: "EINNAHME" },
});
}
console.log(`✓ Seeded ${einnahmeKategorien.length} Einnahme categories`);
for (const name of ausgabeKategorien) {
await prisma.buchungKategorie.upsert({
where: { companyId_name_typ: { companyId: company.id, name, typ: "AUSGABE" } },
update: {},
create: { companyId: company.id, name, typ: "AUSGABE" },
});
}
console.log(`✓ Seeded ${ausgabeKategorien.length} Ausgabe categories`);
console.log("\n✅ Seed complete!");
console.log("Login: anna@example.de / demo123");
console.log("Login: anna@example.de / annas_password");
}
main()