From f82f46ef4fc67ad3b04d2931f98f04acd3a6cdfd Mon Sep 17 00:00:00 2001 From: wolin_chenyulin001 <123@163.com> Date: Mon, 21 Sep 2026 14:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=B1=E4=B8=9A=E7=9A=84schema=EF=BC=9A?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E4=BD=93=E5=92=8C=E5=93=8D=E5=BA=94=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PythonProject/schema/employment_schema.py | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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