Files
SST/PythonProject/schema/employment_schema.py
T

30 lines
824 B
Python
Raw Normal View History

2026-09-21 14:13:23 +08:00
from fastapi import Query,HTTPException
from pydantic import BaseModel, field_validator
from datetime import datetime
class EmlpoymentRequest(BaseModel):
stu_id: int=Query(ge=1)
email: str|None
employment_opening_date:datetime
offer_issuance_date:datetime
company_name:str
company_address:str|None
salary:float
@field_validator('stu_id')
def check(cls,n):
i = cls.model_dump()
if i['stu_id'] == n:
return n
raise HTTPException(status_code=404,detail='未找到该学生的就业信息!')
class EmploymentResponse(BaseModel):
code:int = 200
detail:str = 'OK'
stu_id: int
email: str | None
employment_opening_date: datetime
offer_issuance_date: datetime
company_name: str
company_address: str | None
salary: float