Finishing ForeignKey Migration and handling of their None values
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import List, Literal, Optional
|
||||
from pydantic import Field, BaseModel
|
||||
from beanie import Indexed, PydanticObjectId
|
||||
|
||||
from firm.core.models import CrudDocument
|
||||
from firm.core.models import CrudDocument, ForeignKey
|
||||
from firm.core.filter import Filter, FilterSchema
|
||||
|
||||
|
||||
@@ -39,16 +39,7 @@ class Individual(EntityType):
|
||||
|
||||
class Employee(BaseModel):
|
||||
position: Indexed(str) = Field(title='Poste')
|
||||
entity_id: PydanticObjectId = Field(
|
||||
foreignKey={
|
||||
"reference": {
|
||||
"resource": "entities",
|
||||
"schema": "Entity",
|
||||
"condition": "entity_data.type=individual"
|
||||
}
|
||||
},
|
||||
title='Employé'
|
||||
)
|
||||
entity_id: PydanticObjectId = ForeignKey("entities", "Entity", title='Employé')
|
||||
|
||||
class Config:
|
||||
title = 'Fiche Employé'
|
||||
|
||||
Reference in New Issue
Block a user