def post_student(): try: s = Student( request.form.get('student_id', default=None, type=int), request.form.get('student_name', default=None, type=str), request.form.get('advisor_id', default=None, type=int), request.form.get('approval_status', default=None, type=str), request.form.get('thesis_topic', default=None, type=str)) out = StudentManager.addStudent(s) except (AssertionError, KeyError, ValueError) as e: out = {"success": False, "desc": str(e)} return to_json_response(out)
def update_thesis_topic(student_id: int, thesis_topic: str): return to_json_response( StudentManager.updateThesisTopic(student_id, thesis_topic))
def approval_rejected(student_id: int): return to_json_response( StudentManager.updateApprovalStatus(student_id, StudentManager.CONST_REJECTED))
def approval_accepted(student_id: int): return to_json_response( StudentManager.updateApprovalStatus(student_id, StudentManager.CONST_ACCEPTED))
def send_approval_request(student_id: int, advisor_id: int): try: out = StudentManager.sendApprovalRequest(student_id, advisor_id) except (AssertionError, KeyError, ValueError) as e: out = {"success": False, "desc": str(e)} return to_json_response(out)
def get_student(student_id): return to_json_response(StudentManager.getStudent(student_id))
def get_students(): return to_json_response(StudentManager.getStudents())
def is_student_valid(student_id: int): try: out = StudentManager.isStudentIdValid(student_id) except (AssertionError, KeyError, ValueError) as e: out = {"success": False, "desc": str(e)} return to_json_response(out)