
- 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
43 lines
892 B
Python
43 lines
892 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from enum import Enum
|
|
|
|
|
|
class AccountType(str, Enum):
|
|
SAVINGS = "savings"
|
|
CHECKING = "checking"
|
|
INVESTMENT = "investment"
|
|
|
|
|
|
class AccountBase(BaseModel):
|
|
account_type: AccountType
|
|
currency: str = "USD"
|
|
|
|
|
|
class AccountCreate(AccountBase):
|
|
"""Request model for creating a new account"""
|
|
pass
|
|
|
|
|
|
class AccountUpdate(BaseModel):
|
|
"""Request model for updating an existing account"""
|
|
account_type: Optional[AccountType] = None
|
|
currency: Optional[str] = None
|
|
|
|
|
|
class AccountInDBBase(AccountBase):
|
|
id: int
|
|
account_number: str
|
|
owner_id: int
|
|
balance: float
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Account(AccountInDBBase):
|
|
"""Response model for account data"""
|
|
pass |