class OwnedByUser(BaseModel): user_id: str = Field(...) class Answer(BaseModel): text: str = Field(...) is_true: bool = Field(...) class QuestionBase(BaseModel): text: str = Field(...) answers: List[Answer] = [] class QuestionIn(QuestionBase): pass class QuestionOut(QuestionBase): id: str = Field(...) pass class QuestionInDB(QuestionBase,OwnedByUser): pass class QuestionCategoryBase(OwnedByUser): name: str # subcategory: Optional[QuestionCategory] = None questions: Optional[List[QuestionBase]] = []