async def update_student(id: str, student_data: StudentModel): """[summary] Update a student by id. [description] Endpoint to update an specific student with all fields. """ student = await db_student_access.update_student(id, student_data.dict()) if student: return student else: raise HTTPException(status_code=status.HTTP_304_NOT_MODIFIED, detail="Student not modified")
async def create_student(student: StudentModel = Body(...)): """[summary] Inserts a new student to DB. [description] Endpoint to add a new student. """ new_student = await db_student_access.create_new_student(student.dict()) if new_student: return new_student else: raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Student could not created")