Files
kakeibo/backend/api.http
T
suphicakir 6eb5440d4d 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>
2026-11-11 23:54:16 +03:00

130 lines
3.7 KiB
HTTP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
### Kakeibo API — örnek istekler (VS Code REST Client eklentisi)
### Satırın üstündeki "Send Request" bağlantısına tıklayın.
@baseUrl = http://localhost:8080/api
### Sağlık kontrolü (DB erişilemezse 503 + "db": "error")
GET {{baseUrl}}/health
# ─────────────────────────── Kimlik doğrulama ───────────────────────────
# REST Client cookie'leri otomatik saklar: kayıt/giriş sonrası diğer istekler oturumlu gider.
### Kayıt (kullanıcı + hane + örnek kategoriler/ödeme türleri oluşur)
POST {{baseUrl}}/auth/register
Content-Type: application/json
{
"name": "Suphi",
"email": "suphi@ornek.com",
"password": "gizli-sifre-123",
"household_name": "Çakır Hanesi"
}
### Davet koduyla kayıt (mevcut haneye "member" olarak katılır; household_name yok sayılır)
# Kod büyük/küçük harf ve tireden bağımsızdır: "abcd-efgh" = "ABCDEFGH"
POST {{baseUrl}}/auth/register
Content-Type: application/json
{
"name": "Ayşe",
"email": "ayse@ornek.com",
"password": "gizli-sifre-123",
"invite_code": "BURAYA-KOD"
}
### Giriş ("remember_me": true → 30 gün, false → tarayıcı kapanınca biter)
POST {{baseUrl}}/auth/login
Content-Type: application/json
{
"email": "suphi@ornek.com",
"password": "gizli-sifre-123",
"remember_me": true
}
### Ben kimim? (oturum yoksa 401)
GET {{baseUrl}}/auth/me
### Çıkış
POST {{baseUrl}}/auth/logout
# ─────────────────────────── Hane ve davetler ───────────────────────────
### Hane bilgisi ve üyeler
GET {{baseUrl}}/household
### Yeni davet kodu (yalnızca hane sahibi; 7 gün geçerli, tek kullanımlık)
POST {{baseUrl}}/household/invites
### Aktif davetler (yalnızca hane sahibi)
GET {{baseUrl}}/household/invites
### Daveti iptal et (yalnızca hane sahibi) — id'yi yukarıdaki listeden alın
DELETE {{baseUrl}}/household/invites/BURAYA-ID
# ─────────────────────────── Kategoriler ───────────────────────────
# Gruplar: needs (Zorunlu) · wants (İstek) · culture (Kültürel) · unexpected (Beklenmeyen)
# Silme yok; "is_active": false ile pasife alınır.
### Kategoriler (aktif olanlar; pasifler için ?include_inactive=true)
GET {{baseUrl}}/categories
### Kategori ekle (grubun sonuna eklenir)
POST {{baseUrl}}/categories
Content-Type: application/json
{
"group": "needs",
"name": "Aidat",
"emoji": "🏢"
}
### Kategori düzenle / pasife al — "version": listede gördüğünüz sürüm (başkası değiştirdiyse 409)
PATCH {{baseUrl}}/categories/BURAYA-ID
Content-Type: application/json
{
"name": "Site Aidatı",
"is_active": true,
"version": 1
}
### Grup içi sıralama — gruptaki TÜM kimlikler (pasifler dahil), istenen sırada
PUT {{baseUrl}}/categories/order
Content-Type: application/json
{
"group": "culture",
"ids": ["ID-1", "ID-2", "ID-3"]
}
# ─────────────────────────── Ödeme türleri ───────────────────────────
### Ödeme türleri
GET {{baseUrl}}/payment-methods
### Ödeme türü ekle
POST {{baseUrl}}/payment-methods
Content-Type: application/json
{
"name": "Yemek Kartı",
"emoji": "🍽️"
}
### Ödeme türü düzenle / pasife al
PATCH {{baseUrl}}/payment-methods/BURAYA-ID
Content-Type: application/json
{
"is_active": false
}
### Ödeme türü sıralama — TÜM kimlikler
PUT {{baseUrl}}/payment-methods/order
Content-Type: application/json
{
"ids": ["ID-1", "ID-2", "ID-3", "ID-4"]
}