feat(dönem): dönem açma, açık dönem, düzenleme ve haftalar (backend)

- /api/periods: liste, açık dönem, aç, detay, düzenle
- Kurallar: tek açık dönem, çakışma yok, bitiş hariç, en fazla 62 gün, kapalı dönem salt okunur
- Tarih daraltılırken dışarıda harcama kalırsa engellenir
- Haftalar Pazartesi başlangıçlı, kısmi haftalar ayrı (takvim yardımcıları)
- Otomatik dönem adı: "Aralık 2026" / "15 Ara 2026 – 14 Oca 2027"
- Testler: takvim (4), dönem kuralları (2), entegrasyon (5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 02:56:13 +03:00
parent a2b4119f3e
commit b883530f76
16 changed files with 1048 additions and 1 deletions
+1
View File
@@ -5,4 +5,5 @@ pub mod common;
pub mod group;
pub mod household;
pub mod invite;
pub mod period;
pub mod user;
+39
View File
@@ -0,0 +1,39 @@
//! `periods` koleksiyonu (DATA_MODEL.md §3.4).
use mongodb::bson::Uuid;
use serde::{Deserialize, Serialize};
use ts_rs::TS;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
#[serde(rename_all = "lowercase")]
#[ts(export)]
pub enum PeriodStatus {
/// Girişler yapılabilir. Hanede en fazla bir tane.
Open,
/// Salt okunur (Faz 6: kapanış sihirbazı, sahip yeniden açabilir).
Closed,
}
impl PeriodStatus {
pub fn as_str(self) -> &'static str {
match self {
PeriodStatus::Open => "open",
PeriodStatus::Closed => "closed",
}
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct Period {
#[serde(rename = "_id")]
pub id: Uuid,
pub name: String,
/// `"YYYY-MM-DD"`, dahil
pub start_date: String,
/// `"YYYY-MM-DD"`, **hariç**
pub end_date: String,
pub status: PeriodStatus,
/// Kuruş
pub savings_goal: i64,
pub version: i32,
}