39 行
691 B
Python
39 行
691 B
Python
from __future__ import annotations
|
|
from pydantic import BaseModel
|
|
from typing import Any
|
|
|
|
|
|
class RelatedLink(BaseModel):
|
|
text: str
|
|
url: str
|
|
|
|
|
|
class FaqQuestionSchema(BaseModel):
|
|
question_id: str
|
|
question: str
|
|
answer: str
|
|
related_links: list[RelatedLink] = []
|
|
|
|
|
|
class FaqQuestionResponse(FaqQuestionSchema):
|
|
id: int
|
|
category_id: int
|
|
sort_order: int = 0
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FaqCategorySchema(BaseModel):
|
|
category_id: str
|
|
name: str
|
|
|
|
|
|
class FaqCategoryResponse(FaqCategorySchema):
|
|
id: int
|
|
sort_order: int = 0
|
|
questions: list[FaqQuestionResponse] = []
|
|
|
|
class Config:
|
|
from_attributes = True
|