Adding opening dates and amount
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
@@ -7,7 +9,6 @@ from pydantic import Field as PydField
|
||||
|
||||
from account.enums import Asset, Liability, CategoryFamily
|
||||
|
||||
|
||||
class AccountBase(SQLModel):
|
||||
name: str = Field(index=True)
|
||||
parent_account_id: Optional[UUID] = Field(default=None, foreign_key="account.id")
|
||||
@@ -19,11 +20,14 @@ class AccountBaseId(AccountBase):
|
||||
path: str = Field(index=True)
|
||||
|
||||
class AccountRead(AccountBaseId):
|
||||
pass
|
||||
opening_date: date = Field()
|
||||
opening_balance: Decimal = Field(decimal_places=2, default=0)
|
||||
|
||||
class BaseAccountWrite(AccountBase):
|
||||
path: SkipJsonSchema[str] = Field(default="")
|
||||
family: SkipJsonSchema[str] = Field(default="")
|
||||
opening_date: date = Field()
|
||||
opening_balance: Decimal = Field(decimal_places=2, default=0)
|
||||
|
||||
class AccountWrite(BaseAccountWrite):
|
||||
type: Asset | Liability = Field()
|
||||
@@ -43,6 +47,9 @@ class AccountCreate(AccountWrite):
|
||||
class AccountUpdate(AccountWrite):
|
||||
pass
|
||||
|
||||
class CategoryRead(AccountBaseId):
|
||||
pass
|
||||
|
||||
class CategoryWrite(BaseAccountWrite):
|
||||
type: CategoryFamily = Field()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user