use serde::{Deserialize, Serialize}; use uuid::Uuid; use chrono::{DateTime, Utc}; // ---------------------------------------- // Database entity models // ---------------------------------------- #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct User { pub id: Uuid, pub name: String, pub email: String, pub password_hash: String, pub role: String, // 'founder', 'builder', 'investor' pub bio: Option, pub skills: Option>, pub linkedin: Option, pub created_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PublicUser { pub id: Uuid, pub name: String, pub email: String, pub role: String, pub bio: Option, pub skills: Option>, pub linkedin: Option, pub created_at: DateTime, } impl From for PublicUser { fn from(user: User) -> Self { Self { id: user.id, name: user.name, email: user.email, role: user.role, bio: user.bio, skills: user.skills, linkedin: user.linkedin, created_at: user.created_at, } } } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct TeamMember { pub id: Uuid, pub idea_id: Uuid, pub user_id: Uuid, pub role_title: String, pub joined_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct TeamMemberDetail { pub id: Uuid, pub user_id: Uuid, pub name: String, pub role_title: String, pub joined_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct JoinRequest { pub id: Uuid, pub idea_id: Uuid, pub builder_id: Uuid, pub message: String, pub status: String, // 'pending', 'accepted', 'rejected' pub created_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct JoinRequestDetail { pub id: Uuid, pub idea_id: Uuid, pub builder_id: Uuid, pub builder_name: String, pub builder_skills: Vec, pub message: String, pub status: String, pub created_at: DateTime, pub idea_title: Option, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct InvestorInterest { pub id: Uuid, pub idea_id: Uuid, pub investor_id: Uuid, pub note: String, pub created_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct InvestorInterestDetail { pub id: Uuid, pub idea_id: Uuid, pub investor_id: Uuid, pub investor_name: String, pub note: String, pub created_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct Idea { pub id: Uuid, pub founder_id: Uuid, pub title: String, pub summary: String, pub description: String, pub category: String, pub stage: String, pub team_slots: Vec, pub ip_hash: String, pub created_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct IdeaDetail { pub id: Uuid, pub founder_id: Uuid, pub founder_name: String, pub title: String, pub summary: String, pub description: String, pub category: String, pub stage: String, pub team_slots: Vec, pub ip_hash: String, pub created_at: DateTime, pub team_members: Vec, pub join_requests: Vec, pub investor_interests: Vec, } // ---------------------------------------- // Request / Response payloads // ---------------------------------------- #[derive(Debug, Deserialize)] pub struct RegisterReq { pub name: String, pub email: String, pub password_hash: String, // For simplicity matches client payload pub role: String, pub bio: Option, pub skills: Option>, pub linkedin: Option>, } #[derive(Debug, Deserialize)] pub struct LoginReq { pub email: String, pub password_hash: String, } #[derive(Debug, Serialize)] pub struct AuthRes { pub token: String, pub user: PublicUser, } #[derive(Debug, Deserialize)] pub struct CreateIdeaReq { pub title: String, pub summary: String, pub description: String, pub category: String, pub stage: String, pub team_slots: Vec, pub ip_hash: String, } #[derive(Debug, Deserialize)] pub struct JoinRequestReq { pub message: String, } #[derive(Debug, Deserialize)] pub struct InvestorInterestReq { pub note: String, } #[derive(Debug, Deserialize)] pub struct JoinRequestStatusReq { pub status: String, // 'accepted', 'rejected' }