Spaces:
Sleeping
Sleeping
| use serde::{Deserialize, Serialize}; | |
| use uuid::Uuid; | |
| use chrono::{DateTime, Utc}; | |
| // ---------------------------------------- | |
| // Database entity models | |
| // ---------------------------------------- | |
| 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<String>, | |
| pub skills: Option<Vec<String>>, | |
| pub linkedin: Option<String>, | |
| pub created_at: DateTime<Utc>, | |
| } | |
| pub struct PublicUser { | |
| pub id: Uuid, | |
| pub name: String, | |
| pub email: String, | |
| pub role: String, | |
| pub bio: Option<String>, | |
| pub skills: Option<Vec<String>>, | |
| pub linkedin: Option<String>, | |
| pub created_at: DateTime<Utc>, | |
| } | |
| impl From<User> 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, | |
| } | |
| } | |
| } | |
| pub struct TeamMember { | |
| pub id: Uuid, | |
| pub idea_id: Uuid, | |
| pub user_id: Uuid, | |
| pub role_title: String, | |
| pub joined_at: DateTime<Utc>, | |
| } | |
| pub struct TeamMemberDetail { | |
| pub id: Uuid, | |
| pub user_id: Uuid, | |
| pub name: String, | |
| pub role_title: String, | |
| pub joined_at: DateTime<Utc>, | |
| } | |
| 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<Utc>, | |
| } | |
| pub struct JoinRequestDetail { | |
| pub id: Uuid, | |
| pub idea_id: Uuid, | |
| pub builder_id: Uuid, | |
| pub builder_name: String, | |
| pub builder_skills: Vec<String>, | |
| pub message: String, | |
| pub status: String, | |
| pub created_at: DateTime<Utc>, | |
| pub idea_title: Option<String>, | |
| } | |
| pub struct InvestorInterest { | |
| pub id: Uuid, | |
| pub idea_id: Uuid, | |
| pub investor_id: Uuid, | |
| pub note: String, | |
| pub created_at: DateTime<Utc>, | |
| } | |
| 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<Utc>, | |
| } | |
| 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<String>, | |
| pub ip_hash: String, | |
| pub created_at: DateTime<Utc>, | |
| } | |
| 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<String>, | |
| pub ip_hash: String, | |
| pub created_at: DateTime<Utc>, | |
| pub team_members: Vec<TeamMemberDetail>, | |
| pub join_requests: Vec<JoinRequestDetail>, | |
| pub investor_interests: Vec<InvestorInterestDetail>, | |
| } | |
| // ---------------------------------------- | |
| // Request / Response payloads | |
| // ---------------------------------------- | |
| pub struct RegisterReq { | |
| pub name: String, | |
| pub email: String, | |
| pub password_hash: String, // For simplicity matches client payload | |
| pub role: String, | |
| pub bio: Option<String>, | |
| pub skills: Option<Vec<String>>, | |
| pub linkedin: Option<Option<String>>, | |
| } | |
| pub struct LoginReq { | |
| pub email: String, | |
| pub password_hash: String, | |
| } | |
| pub struct AuthRes { | |
| pub token: String, | |
| pub user: PublicUser, | |
| } | |
| pub struct CreateIdeaReq { | |
| pub title: String, | |
| pub summary: String, | |
| pub description: String, | |
| pub category: String, | |
| pub stage: String, | |
| pub team_slots: Vec<String>, | |
| pub ip_hash: String, | |
| } | |
| pub struct JoinRequestReq { | |
| pub message: String, | |
| } | |
| pub struct InvestorInterestReq { | |
| pub note: String, | |
| } | |
| pub struct JoinRequestStatusReq { | |
| pub status: String, // 'accepted', 'rejected' | |
| } | |