Обновление приложения
This commit is contained in:
53
backend/app/schemas/account.py
Normal file
53
backend/app/schemas/account.py
Normal file
@@ -0,0 +1,53 @@
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from pydantic import BaseModel, Field
|
||||
from app.schemas.currency import CurrencyOut
|
||||
|
||||
|
||||
class AccountTypeOut(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
icon: str | None = None
|
||||
description: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class AccountCreate(BaseModel):
|
||||
name: str = Field(..., max_length=200)
|
||||
account_type_id: int
|
||||
currency_id: int
|
||||
initial_balance: Decimal = Decimal("0.00")
|
||||
credit_limit: Decimal | None = None
|
||||
description: str | None = None
|
||||
icon: str | None = None
|
||||
color: str | None = Field(None, pattern=r"^#[0-9A-Fa-f]{6}$")
|
||||
|
||||
|
||||
class AccountUpdate(BaseModel):
|
||||
name: str | None = Field(None, max_length=200)
|
||||
is_active: bool | None = None
|
||||
credit_limit: Decimal | None = None
|
||||
description: str | None = None
|
||||
icon: str | None = None
|
||||
color: str | None = Field(None, pattern=r"^#[0-9A-Fa-f]{6}$")
|
||||
|
||||
|
||||
class AccountOut(BaseModel):
|
||||
id: int
|
||||
user_id: int
|
||||
name: str
|
||||
account_type_id: int
|
||||
account_type: AccountTypeOut
|
||||
currency_id: int
|
||||
currency: CurrencyOut
|
||||
balance: Decimal
|
||||
initial_balance: Decimal
|
||||
is_active: bool
|
||||
credit_limit: Decimal | None = None
|
||||
description: str | None = None
|
||||
icon: str | None = None
|
||||
color: str | None = None
|
||||
created_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user