feat(dönem): dönem kapatma, devir ve düzeltme için yeniden açma (backend)

- POST /periods/{id}/close: tek transaction; açık → borç, artı → birikim + devir
- Devir sonraki dönem açılınca ona bağlanır
- POST /periods/{id}/reopen (sahip): düzeltme modu, yeni dönem açık kalır

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 12:20:09 +03:00
parent 8ec1fd6f25
commit 62e92f552a
17 changed files with 724 additions and 26 deletions
+2
View File
@@ -14,6 +14,8 @@ const period: Period = {
status: 'open',
savings_goal: 500_000,
reflection_md: null,
to_savings: null,
closed_at: null,
version: 3,
weeks: [
{ index: 1, start_date: '2026-12-01', last_date: '2026-12-06', days: 6 },
+11
View File
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Carryover = {
/**
* `debt` (borç) · `surplus` (artı)
*/
kind: "debt" | "surplus", amount: number,
/**
* Sonraki dönem henüz açılmadıysa `null` (açılınca bağlanır)
*/
to_period_id: string | null, };
+9 -1
View File
@@ -22,4 +22,12 @@ savings_goal: number,
/**
* "Nasıl daha iyi yapabilirim?" (Markdown)
*/
reflection_md: string | null, version: number, weeks: Array<PeriodWeek>, };
reflection_md: string | null,
/**
* Kapanışta birikime aktarılan (kuruş); kapanmamışsa `null`
*/
to_savings: number | null,
/**
* Kapanış zamanı (ISO 8601)
*/
closed_at: string | null, version: number, weeks: Array<PeriodWeek>, };
+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 PeriodCloseRequest = {
/**
* Birikime aktarılacak (kuruş); verilmezse gerçekleşen birikimin tamamı. Kalanı artı olarak devreder.
*/
to_savings?: number, version?: number, };
+13
View File
@@ -0,0 +1,13 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Carryover } from "./Carryover";
import type { Period } from "./Period";
export type PeriodCloseResult = { period: Period,
/**
* Değerlendirmenin 4. sorusu (negatifse açık)
*/
realized_savings: number, to_savings: number,
/**
* Sonraki döneme devreden; yoksa `null`
*/
carryover: Carryover | null, };
+1 -1
View File
@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type PeriodStatus = "open" | "closed";
export type PeriodStatus = "open" | "closed" | "correcting";