diff --git a/PythonProject/schema/employment_schema.py b/PythonProject/schema/employment_schema.py index e69de29..47a153f 100644 --- a/PythonProject/schema/employment_schema.py +++ b/PythonProject/schema/employment_schema.py @@ -0,0 +1,30 @@ +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 \ No newline at end of file