
- Setup project structure and basic FastAPI application - Define database models for users, profiles, matches, and messages - Set up database connection and create Alembic migrations - Implement user authentication and registration endpoints - Create API endpoints for profile management, matches, and messaging - Add filtering and search functionality for tech profiles - Setup environment variable configuration - Create README with project information and setup instructions
72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
from pydantic import BaseModel, validator
|
|
from typing import Optional, List
|
|
from datetime import date, datetime
|
|
from enum import Enum
|
|
|
|
|
|
class GenderEnum(str, Enum):
|
|
male = "male"
|
|
female = "female"
|
|
non_binary = "non_binary"
|
|
other = "other"
|
|
|
|
|
|
class ProfileBase(BaseModel):
|
|
full_name: Optional[str] = None
|
|
bio: Optional[str] = None
|
|
gender: Optional[GenderEnum] = None
|
|
date_of_birth: Optional[date] = None
|
|
location: Optional[str] = None
|
|
job_title: Optional[str] = None
|
|
company: Optional[str] = None
|
|
education: Optional[str] = None
|
|
profile_picture: Optional[str] = None
|
|
interests: Optional[str] = None # Comma-separated
|
|
tech_stack: Optional[str] = None # Comma-separated
|
|
github_url: Optional[str] = None
|
|
linkedin_url: Optional[str] = None
|
|
portfolio_url: Optional[str] = None
|
|
is_visible: Optional[bool] = True
|
|
|
|
|
|
class ProfileCreate(ProfileBase):
|
|
full_name: str
|
|
gender: GenderEnum
|
|
date_of_birth: date
|
|
|
|
@validator('date_of_birth')
|
|
def validate_date_of_birth(cls, v):
|
|
today = date.today()
|
|
age = today.year - v.year - ((today.month, today.day) < (v.month, v.day))
|
|
if age < 18:
|
|
raise ValueError("User must be at least 18 years old")
|
|
return v
|
|
|
|
|
|
class ProfileUpdate(ProfileBase):
|
|
pass
|
|
|
|
|
|
class ProfileInDBBase(ProfileBase):
|
|
id: int
|
|
user_id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class Profile(ProfileInDBBase):
|
|
# Process comma-separated strings to lists
|
|
@property
|
|
def interests_list(self) -> List[str]:
|
|
return self.interests.split(',') if self.interests else []
|
|
|
|
@property
|
|
def tech_stack_list(self) -> List[str]:
|
|
return self.tech_stack.split(',') if self.tech_stack else []
|
|
|
|
|
|
class ProfileInDB(ProfileInDBBase):
|
|
pass |