feat: backend project setup with FastAPI structure and dependencies
- Create directory structure per IMPLEMENTATION_PLAN.md Section 12 - Add requirements.txt with FastAPI, SQLAlchemy, CrewAI, etc. - Add core/config.py for environment variable configuration - Add core/database.py for SQLite connection - Add core/security.py for password hashing and JWT - Add FastAPI app entry point (main.py) with all API routers - Add Uvicorn runner (run.py) - Add API route stubs (auth, bots, backtest, simulate, config) - Add db/models.py with SQLAlchemy models - Add db/schemas.py with Pydantic schemas - Add service stubs (ai_agent, backtest, simulate engines) - Add .env.example with all required environment variables - Verify server starts correctly
This commit is contained in:
93
src/backend/app/db/schemas.py
Normal file
93
src/backend/app/db/schemas.py
Normal file
@@ -0,0 +1,93 @@
|
||||
from pydantic import BaseModel, EmailStr
|
||||
from typing import Optional, List, Any
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class UserCreate(BaseModel):
|
||||
email: EmailStr
|
||||
password: str
|
||||
|
||||
|
||||
class UserResponse(BaseModel):
|
||||
id: str
|
||||
email: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class Token(BaseModel):
|
||||
access_token: str
|
||||
token_type: str
|
||||
|
||||
|
||||
class BotCreate(BaseModel):
|
||||
name: str
|
||||
description: Optional[str] = None
|
||||
strategy_config: dict
|
||||
llm_config: dict
|
||||
|
||||
|
||||
class BotUpdate(BaseModel):
|
||||
name: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
strategy_config: Optional[dict] = None
|
||||
llm_config: Optional[dict] = None
|
||||
status: Optional[str] = None
|
||||
|
||||
|
||||
class BotResponse(BaseModel):
|
||||
id: str
|
||||
user_id: str
|
||||
name: str
|
||||
description: Optional[str]
|
||||
strategy_config: dict
|
||||
llm_config: dict
|
||||
status: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class BacktestCreate(BaseModel):
|
||||
token: str
|
||||
chain: str
|
||||
timeframe: str
|
||||
start_date: str
|
||||
end_date: str
|
||||
|
||||
|
||||
class BacktestResponse(BaseModel):
|
||||
id: str
|
||||
bot_id: str
|
||||
started_at: datetime
|
||||
ended_at: Optional[datetime]
|
||||
status: str
|
||||
config: dict
|
||||
result: Optional[dict]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class SimulationCreate(BaseModel):
|
||||
token: str
|
||||
chain: str
|
||||
duration_seconds: int = 3600
|
||||
auto_execute: bool = False
|
||||
|
||||
|
||||
class SimulationResponse(BaseModel):
|
||||
id: str
|
||||
bot_id: str
|
||||
started_at: datetime
|
||||
status: str
|
||||
config: dict
|
||||
signals: Optional[List[dict]]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user