initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from .routes import router as entity_router
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
from enum import Enum
|
||||
from datetime import datetime
|
||||
from pydantic import Field
|
||||
|
||||
from beanie import Document
|
||||
|
||||
|
||||
class EntityType(str, Enum):
|
||||
individual = 'individual'
|
||||
corporation = 'corporation'
|
||||
institution = 'institution'
|
||||
|
||||
|
||||
class Entity(Document):
|
||||
_id: str
|
||||
type: EntityType
|
||||
name: str
|
||||
address: str
|
||||
created_at: datetime = Field(default=datetime.utcnow(), nullable=False)
|
||||
updated_at: datetime = Field(default_factory=datetime.utcnow, nullable=False)
|
||||
@@ -0,0 +1,7 @@
|
||||
from ..core.routes import get_crud_router
|
||||
from .models import Entity
|
||||
from .schemas import EntityCreate, EntityRead, EntityUpdate
|
||||
|
||||
router = get_crud_router(Entity, EntityCreate, EntityRead, EntityUpdate)
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import uuid
|
||||
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .models import Entity, EntityType
|
||||
|
||||
|
||||
class EntityRead(Entity):
|
||||
pass
|
||||
|
||||
|
||||
class EntityCreate(BaseModel):
|
||||
type: EntityType
|
||||
name: str
|
||||
address: str
|
||||
|
||||
|
||||
class EntityUpdate(BaseModel):
|
||||
name: str
|
||||
Reference in New Issue
Block a user