feat: add AppState and domain models

- Introduce state.rs with AppState (HTTP client + token/user_id state)
- Define core models in models.rs (User, Workspace, Conversation, Message, AuthTokenResponse)
- Integrate state management into lib.rs via .manage(AppState::new())
This commit is contained in:
2026-08-12 16:56:03 +02:00
parent a1032ddf11
commit 55133751cb
3 changed files with 68 additions and 0 deletions

43
src-tauri/src/models.rs Normal file
View File

@@ -0,0 +1,43 @@
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone)]
pub struct User {
pub id: String,
pub email: String,
pub username: String,
pub display_name: String,
pub avatar_url: Option<String>,
pub bio: Option<String>,
}
#[derive(Serialize, Deserialize)]
pub struct Workspace {
pub id: String,
pub name: String,
pub slug: String,
pub owner_id: String,
}
#[derive(Serialize, Deserialize)]
pub struct Conversation {
pub id: String,
pub workspace_id: Option<String>,
pub kind: String,
pub name: Option<String>,
pub is_public: bool,
pub created_by: String,
}
#[derive(Serialize, Deserialize)]
pub struct Message {
pub id: String,
pub conversation_id: String,
pub user_id: String,
pub content: String,
pub created_at: String,
}
#[derive(Deserialize)]
pub struct AuthTokenResponse {
pub token: String,
}