feat(katalog): kategori ve ödeme türü uç noktaları, hane izolasyonu entegrasyon testleri

- /api/categories ve /api/payment-methods: listele, ekle, düzenle, sırala, pasife al
- Sürüm kontrolü ile eşzamanlı düzenleme çakışması (409)
- Backend lib + bin yapısına ayrıldı (entegrasyon testleri için)
- tests/: hane izolasyonu (3) ve katalog (4) entegrasyon testleri
- db:reset artık artık test veritabanlarını da siler
- api.http tamamlandı; Faz 1 tamamlandı

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 23:54:16 +03:00
parent 4cc4fa5882
commit 6eb5440d4d
21 changed files with 1257 additions and 44 deletions
-9
View File
@@ -36,15 +36,6 @@ pub fn scope(household_id: Uuid) -> Document {
doc! { "household_id": household_id, "deleted_at": null }
}
#[allow(dead_code)] // Faz 1 – Adım 5'te (kategori güncelleme) kullanılacak
/// Güncellemelerde eklenecek ortak kısım: `updated_at` yenilenir, `version` +1.
pub fn touch() -> Document {
doc! {
"$set": { "updated_at": now() },
"$inc": { "version": 1_i32 },
}
}
#[cfg(test)]
mod tests {
use super::*;
+39
View File
@@ -0,0 +1,39 @@
//! 4 sabit ana grup (DATA_MODEL.md §2). Değiştirilemez, silinemez; veritabanında değil kodda.
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Group {
/// 🏠 Zorunlu
Needs,
/// 🛍️ İstek
Wants,
/// 📚 Kültürel
Culture,
/// ⚡ Beklenmeyen
Unexpected,
}
impl Group {
pub const ALL: [Group; 4] = [
Group::Needs,
Group::Wants,
Group::Culture,
Group::Unexpected,
];
pub fn as_str(self) -> &'static str {
match self {
Group::Needs => "needs",
Group::Wants => "wants",
Group::Culture => "culture",
Group::Unexpected => "unexpected",
}
}
/// Ekranda gösterim sırası
pub fn order(self) -> usize {
Self::ALL.iter().position(|g| *g == self).unwrap_or(0)
}
}
+1
View File
@@ -2,6 +2,7 @@
//! Şema: `docs/DATA_MODEL.md`
pub mod common;
pub mod group;
pub mod household;
pub mod invite;
pub mod user;