
- Set up project structure with FastAPI - Implement user and account management - Add send and receive money functionality - Set up transaction processing system - Add JWT authentication - Configure SQLAlchemy with SQLite - Set up Alembic for database migrations - Create comprehensive API documentation
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
from pydantic import BaseModel, EmailStr, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
email: EmailStr
|
|
first_name: str = Field(..., min_length=1, max_length=100)
|
|
last_name: str = Field(..., min_length=1, max_length=100)
|
|
is_active: Optional[bool] = True
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
password: str = Field(..., min_length=8)
|
|
|
|
|
|
class UserUpdate(BaseModel):
|
|
email: Optional[EmailStr] = None
|
|
first_name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
last_name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
is_active: Optional[bool] = None
|
|
password: Optional[str] = Field(None, min_length=8)
|
|
|
|
|
|
class UserInDBBase(UserBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class User(UserInDBBase):
|
|
"""Response model for user without sensitive data"""
|
|
pass
|
|
|
|
|
|
class UserInDB(UserInDBBase):
|
|
"""Model with password hash for internal use"""
|
|
hashed_password: str |