feat: add financial transactions management for companies

- Implemented a new route for managing financial transactions (money) for companies, including creating, editing, and deleting transactions.
- Added a new model `Buchung` to represent transactions with fields for date, account type, transaction type, amount, and description.
- Updated the `companies` model to include a relation to the new `Buchung` model.
- Enhanced the company overview page to link to the new financial transactions page.
- Added migration scripts to create the necessary database tables and fields for the new functionality.
- Created utility scripts for resetting the admin password and setting up the initial admin user.
This commit is contained in:
hwinkel
2026-03-24 19:25:48 +01:00
parent 6d8c4b615f
commit d582c748a2
29 changed files with 2464 additions and 815 deletions
+37
View File
@@ -73,12 +73,40 @@ model Company {
betriebsausgaben Betriebsausgabe[]
betriebseinnahmen Betriebseinnahme[]
anlagegueter Anlagegut[]
buchungen Buchung[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("companies")
}
enum TransactionAccount {
KASSE
BANK
}
enum TransactionType {
EINLAGE
ENTNAHME
}
model Buchung {
id String @id @default(cuid())
companyId String
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
date DateTime
account TransactionAccount
type TransactionType
amount Decimal @db.Decimal(10, 2)
description String? @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([companyId])
@@index([date])
@@map("buchungen")
}
model Service {
id String @id @default(cuid())
companyId String
@@ -146,6 +174,11 @@ enum InvoiceStatus {
DELETED
}
enum Zahlungsart {
KASSE
BANK
}
enum EinnahmeKategorie {
FUSSPFLEGE
PRIVATEINLAGEN
@@ -165,6 +198,8 @@ model Betriebseinnahme {
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
kategorie EinnahmeKategorie
betrag Decimal @db.Decimal(10, 2)
steuersatz Decimal @db.Decimal(5, 2) @default(0)
zahlungsart Zahlungsart @default(BANK)
datum DateTime
beschreibung String? @db.Text
createdAt DateTime @default(now())
@@ -219,6 +254,8 @@ model Betriebsausgabe {
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
kategorie AusgabeKategorie
betrag Decimal @db.Decimal(10, 2)
steuersatz Decimal @db.Decimal(5, 2) @default(0)
zahlungsart Zahlungsart @default(BANK)
datum DateTime
beschreibung String? @db.Text
createdAt DateTime @default(now())