initial commit

This commit is contained in:
2023-01-09 13:03:16 +01:00
commit d0c0668fad
89 changed files with 12472 additions and 0 deletions

View File

@@ -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.

20
back/app/entity/models.py Normal file
View File

@@ -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)

View File

@@ -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)

View File

@@ -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