feat(bütçe): aylık/haftalık bütçe, bütçe önerisi ve dönem özeti (backend)

- /api/periods/{id}/summary: gelir − sabit gider − birikim − devreden borç + artı = harcanabilir
- /api/periods/{id}/budget: 4 grup aylık; haftalar gün sayısına göre, toplam kuruşu kuruşuna eşit
- Elle hafta ayarı (kalan diğer haftalara dağılır), otomatiğe dönüş, aşım uyarısı
- Öneri: varsayılan yüzdeler / önceki dönem / son 3 dönem ortalaması
- Testler: orantılı bölme (3), bütçe entegrasyon (6)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 03:42:49 +03:00
parent 7f3fde074c
commit 95231cd4d6
16 changed files with 1337 additions and 3 deletions
+8
View File
@@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { GroupAmounts } from "./GroupAmounts";
export type BudgetSuggestion = {
/**
* `false` → bu yöntem için veri yok (`message` nedenini söyler)
*/
available: boolean, message: string | null, amounts: GroupAmounts, };
+12
View File
@@ -0,0 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Group } from "./Group";
export type BudgetWeekRequest = { group: Group,
/**
* Haftanın ilk günü (`PeriodWeek.start_date`)
*/
week_start: string,
/**
* Kuruş; `null` → otomatiğe döndür
*/
amount: number | null, };
+6
View File
@@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* Gruplara göre tutarlar (kuruş)
*/
export type GroupAmounts = { needs: number, wants: number, culture: number, unexpected: number, };
+9
View File
@@ -0,0 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Group } from "./Group";
import type { WeekBudget } from "./WeekBudget";
export type GroupBudget = { group: Group, monthly: number,
/**
* Elle girilen haftaların toplamı aylık tutarı aşıyor
*/
weekly_over: boolean, weeks: Array<WeekBudget>, };
+23
View File
@@ -0,0 +1,23 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type PeriodSummary = { income_total: number, fixed_expense_total: number, savings_goal: number,
/**
* Önceki dönemden devreden borç
*/
carryover_debt: number,
/**
* Önceki dönemden devreden artı bakiye
*/
carryover_surplus: number,
/**
* gelir − sabit gider − birikim − borç + artı
*/
spendable: number,
/**
* 4 grubun aylık bütçe toplamı
*/
budget_total: number,
/**
* harcanabilir − dağıtılan (negatifse fazla dağıtılmış)
*/
unallocated: number, };
+3
View File
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type SuggestMethod = "default" | "previous" | "avg3";
+7
View File
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type WeekBudget = { index: number, start_date: string, last_date: string, days: number, amount: number,
/**
* Elle girildi (otomatik değil)
*/
is_manual: boolean, };