feat(kayıt): yeni hane kaydı yalnızca davetle (REGISTRATION=invite_only)

- REGISTRATION ortam değişkeni: invite_only (varsayılan) | open
- invite_only: ilk hane serbest, sonrasında yalnızca davet koduyla katılım
- Backend'de zorunlu: 403 registration_closed; GET /api/auth/registration
- Kayıt ekranı: kayıt kapalıyken yalnızca davet kodu ve açıklama
- Entegrasyon testleri: kayıt politikası (2)
- Prettier ayarı eklendi (proje stiliyle uyumlu), kaynaklar biçimlendirildi

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 01:04:48 +03:00
parent 9cbeaaaf76
commit e188922c0f
29 changed files with 547 additions and 230 deletions
+11 -1
View File
@@ -11,7 +11,11 @@ use axum::{
http::{Method, Request, StatusCode, header},
};
use http_body_util::BodyExt;
use kakeibo::{config::Config, db, routes, state::AppState};
use kakeibo::{
config::{Config, RegistrationMode},
db, routes,
state::AppState,
};
use mongodb::Database;
use serde_json::{Value, json};
use tower::ServiceExt;
@@ -29,7 +33,12 @@ pub struct Session {
}
impl TestApp {
/// Kayıt açık (birden fazla hane gerektiren testler için).
pub async fn new() -> Self {
Self::with_registration(RegistrationMode::Open).await
}
pub async fn with_registration(registration: RegistrationMode) -> Self {
dotenvy::dotenv().ok();
let uri = std::env::var("MONGODB_URI")
.expect("MONGODB_URI tanımlı değil (.env dosyasını kontrol edin)");
@@ -46,6 +55,7 @@ impl TestApp {
jwt_secret: "test-jwt-secret-en-az-32-karakter-olmali!!".into(),
app_url: "http://localhost".into(),
port: 0,
registration,
};
let router = routes::router(AppState::new(db.clone(), config));
Self { router, db }