Rework real estate model: purchase price + mortgage + amortization only, no appreciation; amortization counts against savings quota; sale price/tax entered at transition time with correct mortgage payoff; carry over income/expenses to new phases
Deploy App / deploy (push) Successful in 1m31s

This commit is contained in:
2026-07-08 21:35:10 +02:00
parent 9609de67ae
commit e9dacc2026
12 changed files with 204 additions and 145 deletions
+3 -5
View File
@@ -23,12 +23,10 @@ const securitySchema = z.object({
});
const realEstateSchema = z.object({
name: z.string().min(1),
marketValue: z.number(),
// Muss zwingend angegeben werden (siehe Anforderung: Kaufpreis ist Pflichtfeld).
purchasePrice: z.number().positive("Kaufpreis muss groesser als 0 sein."),
mortgage: z.number(),
valueGrowth: z.number(),
amortization: z.number(),
salePrice: z.number().nullable().optional(),
saleTaxRate: z.number().min(0).max(100),
});
const oneTimeEventSchema = z.object({
type: z.enum(["INCOME", "EXPENSE"]),
@@ -96,7 +94,7 @@ export async function PUT(
incomeEntries: { create: data.incomeEntries.map((e) => ({ ...e, label: e.label ?? null, personId: e.personId ?? null })) },
expenseEntries: { create: data.expenseEntries.map((e) => ({ ...e, label: e.label ?? null })) },
securities: { create: data.securities },
realEstates: { create: data.realEstates.map((re) => ({ ...re, salePrice: re.salePrice ?? null })) },
realEstates: { create: data.realEstates },
oneTimeEvents: { create: data.oneTimeEvents.map((e) => ({ ...e, description: e.description ?? null })) },
retirementInfos: { create: data.retirementInfos },
},