#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import List, Optional from pydantic import Field from pydantic.main import BaseModel from schemas.base import ListMixin, Datetime2Str, DetailMixin class QuestionInfo(BaseModel): id: Optional[int] = None pid: Optional[int] = None pno: str = Field(..., description="试卷编号") qno: str = Field(..., description="题号") sqno: str = Field(..., description="子题号") qtype: Optional[int] = None points: str = Field(..., description="试题标准点坐标") imgs: Optional[str] = None stuff_points: Optional[str] = None stuff_imgs: Optional[str] = None answer: Optional[str] = None analysis: Optional[str] = None score: Optional[float] = None stem: Optional[str] = None creator_name: Optional[str] = None created_at: Datetime2Str = None class Config: orm_mode = True anystr_strip_whitespace = True class QuestionList(ListMixin): data: List[QuestionInfo] = [] class QuestionDetail(DetailMixin): data: Optional[QuestionInfo] = {} class Point(BaseModel): x: Optional[float] = None y: Optional[float] = None w: Optional[float] = None h: Optional[float] = None class QuestionPieceInfo(BaseModel): id: Optional[int] = None page: Optional[int] = None qno: str = Field(..., description="题号") sqno: str = Field(..., description="子题号") imgtype: Optional[int] = None points: List[Point] = None imgs: List[str] = [] class SaveQuePieceInfo(BaseModel): id: Optional[int] = None pid: Optional[int] = None pno: Optional[str] = None ques: List[QuestionPieceInfo] = None