19 lines
434 B
Python
19 lines
434 B
Python
from typing import Optional
|
|
|
|
from beanie import PydanticObjectId
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Reader(BaseModel):
|
|
id: Optional[PydanticObjectId] = Field(default=None, validation_alias="_id")
|
|
|
|
@classmethod
|
|
def from_model(cls, model):
|
|
schema = cls.model_validate(model, from_attributes=True)
|
|
return schema
|
|
|
|
|
|
class Writer(BaseModel):
|
|
async def validate_foreign_key(self, db):
|
|
pass
|