就业get次昂管的dao层和api接口
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
from fastapi import FastAPI,APIRouter,Depends,HTTPException
|
from fastapi import APIRouter,Depends,HTTPException
|
||||||
|
|
||||||
from dao import employment_dao
|
from dao import employment_dao
|
||||||
from dao.employment_dao import get_employment_dao
|
from dao.employment_dao import get_employment_dao
|
||||||
from schema.employment_schema import EmlpoymentRequest,EmploymentResponse
|
from schema.employment_schema import EmploymentRequest,EmploymentResponse
|
||||||
from model.all_model import ClassManagement,Employment_info
|
from model.all_model import ClassManagement,Employment_info
|
||||||
from util.database import get_db
|
from util.database import get_db
|
||||||
|
|
||||||
emp_api = FastAPI()
|
emp_api = APIRouter()
|
||||||
@emp_api.get('employment/students/{stu_id}',response_model=EmploymentResponse,summary='获取学生就业信息')
|
@emp_api.get('employment/students/{stu_id}',response_model=EmploymentResponse,summary='获取学生就业信息')
|
||||||
def get_emp_info1(stu_id: int,db=Depends(get_db)):
|
def get_emp_info1(stu_id: int,db=Depends(get_db)):
|
||||||
try:
|
try:
|
||||||
@@ -23,7 +23,7 @@ def get_emp_info2(class_id: int,db=Depends(get_db)):
|
|||||||
except:
|
except:
|
||||||
raise HTTPException(status_code=404, detail='该班级就业信息不存在')
|
raise HTTPException(status_code=404, detail='该班级就业信息不存在')
|
||||||
|
|
||||||
# @app.post('employment/students/{stu_id}')
|
# @emp_api.post('employment/students/{stu_id}')
|
||||||
# def create_emp_info(stu_id: int,db=Depends(get_db)):
|
# def create_emp_info(stu_id: int,db=Depends(get_db)):
|
||||||
# try:
|
# try:
|
||||||
pass
|
# pass
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from fastapi import HTTPException,Depends
|
from fastapi import HTTPException,Depends
|
||||||
from model.all_model import Employment_info, ClassManagement, Student_Model
|
from model.all_model import Employment_info, ClassManagement, Student_Model
|
||||||
from util.database import get_db
|
from util.database import get_db
|
||||||
from schema.employment_schema import EmlpoymentRequest
|
from schema.employment_schema import EmploymentRequest
|
||||||
|
|
||||||
def get_employment_dao(stu_id,class_id,db=Depends(get_db())):
|
def get_employment_dao(stu_id,class_id,db=Depends(get_db())):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from pydantic import BaseModel, field_validator
|
|||||||
from datetime import date
|
from datetime import date
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
class EmlpoymentRequest(BaseModel):
|
class EmploymentRequest(BaseModel):
|
||||||
stu_id: int=Query(ge=1)
|
stu_id: int=Query(ge=1)
|
||||||
email: str|None
|
email: str|None
|
||||||
employment_opening_date:date
|
employment_opening_date:date
|
||||||
|
|||||||
Reference in New Issue
Block a user