24 lines
618 B
Python
24 lines
618 B
Python
from pydantic import Field
|
|
|
|
from firm.entity.models import Entity, Institution, Individual, Corporation
|
|
from firm.core.schemas import Writer, Reader
|
|
|
|
class EntityRead(Reader, Entity):
|
|
pass
|
|
|
|
class EntityCreate(Writer):
|
|
entity_data: Individual | Corporation | Institution = Field(..., discriminator='type')
|
|
address: str = Field(default="", title='Adresse')
|
|
|
|
class Config:
|
|
title = "Création d'un client"
|
|
|
|
class EntityIndividualCreate(EntityCreate):
|
|
entity_data: Individual
|
|
|
|
class EntityCorporationCreate(EntityCreate):
|
|
entity_data: Corporation
|
|
|
|
class EntityUpdate(EntityCreate):
|
|
pass
|