42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
|
|
|
|
class BotBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
roi_percentage: float = Field(..., gt=0)
|
|
duration_hours: int = Field(..., gt=0)
|
|
min_purchase_amount: float = Field(..., gt=0)
|
|
max_purchase_amount: float = Field(..., gt=0)
|
|
is_active: bool = True
|
|
|
|
|
|
class BotCreate(BotBase):
|
|
pass
|
|
|
|
|
|
class BotUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
roi_percentage: Optional[float] = Field(None, gt=0)
|
|
duration_hours: Optional[int] = Field(None, gt=0)
|
|
min_purchase_amount: Optional[float] = Field(None, gt=0)
|
|
max_purchase_amount: Optional[float] = Field(None, gt=0)
|
|
is_active: Optional[bool] = None
|
|
image_path: Optional[str] = None
|
|
|
|
|
|
class BotInDBBase(BotBase):
|
|
id: int
|
|
image_path: Optional[str] = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class Bot(BotInDBBase):
|
|
pass |