15 lines
433 B
Python
15 lines
433 B
Python
from pydantic import BaseModel, Field
|
|||
|
|
from typing import Optional
|
||
|
|
|
||
|
|
|
||
|
|
class CourseRequest(BaseModel):
|
||
|
|
course_id: str = Field(..., description='课程编号')
|
||
|
|
course_name: str = Field(..., description='课程名称')
|
||
|
|
teacher_id: Optional[str] = Field(None, description='授课教师编号')
|
||
|
|
|
||
|
|
|
||
|
|
class CourseResponse(BaseModel):
|
||
|
|
code: int = 200
|
||
|
|
detail: str = 'OK'
|
||
|
|
totals: int = 0
|
||
|
|
data: str | dict | tuple | list
|