def update_gpa_by_course(courseId, userId, gpa): try: token = request.headers.get('Authorization') if (Service.auth_token(token)): response = Service.update_gpa_by_course(courseId, userId, gpa) if (response): return jsonpickle.encode(response, unpicklable=False), 200 else: return jsonify({'Error': 'Something went wrong'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 except Exception as e: return jsonify(e), 500
def get_profile_details(userId, roleId): try: token = request.headers.get('Authorization') if (Service.auth_token(token)): response = Service.get_profile_details(userId, roleId) if (response): return jsonpickle.encode(response, unpicklable=False), 200 else: return jsonify({'Error': 'Something went wrong'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 except Exception as e: return jsonify(e), 500
def semesters(): data = request.json try: token = request.headers.get('Authorization') if (Service.auth_token(token)): response = Service.semesters() if (response): return jsonpickle.encode(response, unpicklable=False), 200 else: return jsonify({'Error': 'Something went wrong'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 except Exception as e: return jsonify(e), 500
def save_comment(): data = request.json try: token = request.headers.get('Authorization') if (Service.auth_token(token)): response = Service.save_comment(data) if (response == True): return jsonify({'data': data}), 200 else: return jsonify({'Error': 'Something went wrong'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 except Exception as e: return jsonify(e), 500
def insert_courses(): data = request.json try: token = request.headers.get('Authorization') if (Service.auth_token(token)): if (data['role_id'] == str(1)): response = Service.insert_courses(data) if (response == True): return jsonify({'data': data}), 200 else: return jsonify({'Error': 'Something went wrong'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 except Exception as e: return jsonify(e), 500
def personal_details(): data = request.json try: token = request.headers.get('Authorization') if (Service.auth_token(token)): response = Service.personal_details(data) if (response == True): if (data['image']): data[ 'image'] = "https://s3.amazonaws.com/course-360/u" + str( data['userId']) + ".jpg" return jsonify({'data': data}), 200 else: return jsonify({'Error': 'Something went wrong'}), 500 else: return jsonify({'Error': 'Unauthorized'}), 500 except Exception as e: return jsonify(e), 500