feat(arayüz): API istemcisi, TanStack Query, ts-rs tip üretimi ve oturum durumu

- Backend: ts-rs ile DTO'lardan TypeScript tipleri (frontend/src/types, npm run types)
- Hata ve health yanıtları tipli yapılara çevrildi
- lib/api.ts: tek API istemcisi, Türkçe ApiError, ağ hatası mesajı
- lib/query.ts: QueryClient (4xx tekrar denenmez, 401 → oturum kapanır)
- lib/auth.ts: useMe, useLogin, useRegister, useLogout
- Vitest: 7 API istemcisi testi (toplam 29)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 00:39:56 +03:00
parent f9be08114d
commit 906f05f62f
41 changed files with 558 additions and 49 deletions
+7 -3
View File
@@ -11,6 +11,7 @@ use axum::{
};
use mongodb::bson::{DateTime, Uuid, doc};
use serde::{Deserialize, Serialize};
use ts_rs::TS;
use crate::{
auth::AuthUser,
@@ -21,14 +22,16 @@ use crate::{
state::AppState,
};
#[derive(Serialize)]
#[derive(Serialize, TS)]
#[ts(export, rename = "Household")]
pub struct HouseholdResponse {
id: String,
name: String,
members: Vec<MemberDto>,
}
#[derive(Serialize)]
#[derive(Serialize, TS)]
#[ts(export, rename = "Member")]
struct MemberDto {
id: String,
name: String,
@@ -36,7 +39,8 @@ struct MemberDto {
role: Role,
}
#[derive(Serialize)]
#[derive(Serialize, TS)]
#[ts(export, rename = "Invite")]
pub struct InviteDto {
id: String,
code: String,