def syncro_mongodb(): status_code = CODE_PUT_OK message = MSG_PUT_OK try: if (__correct_token()): dataDict = json.loads(request.data) Syncro().syncro_MongoDB(dataDict.get('token')) except EpepinException as ex: status_code = ex.get_status_code() message = ex.get_error_message() return Response.json_data(status_code, message, None, None)
def delete_requirement(requirement_id): status_code = CODE_DELETE_OK message = MSG_DELETE_OK try: if (__correct_token()): db = database_connection() connection = db.connection() db.delete_requirement(connection, requirement_id) except EpepinException as ex: status_code = ex.get_status_code() message = ex.get_error_message() return Response.json_data(status_code, message, None, requirement_id)
def get_comments(): status_code = CODE_GET_OK message = MSG_GET_OK reviewers = None try: db = database_connection() connection = db.connection() reviewers = db.get_comments(connection) except EpepinException as ex: status_code = ex.get_status_code() message = ex.get_error_message() return Response.json_data(status_code, message, reviewers, None)
def get_requirements(): status_code = CODE_GET_OK message = MSG_GET_OK requirements = None try: if (__correct_token()): db = database_connection() connection = db.connection() requirements = db.get_requirements(connection) except EpepinException as ex: status_code = ex.get_status_code() message = ex.get_error_message() return Response.json_data(status_code, message, requirements, None)
def update_requirement(requirement_id): status_code = CODE_PUT_OK message = MSG_PUT_OK try: if (__correct_token()): data = request.get_json() input_data = copy.deepcopy(data) validate(data, 'requirement.json') db = database_connection() connection = db.connection() db.update_requirement(connection, requirement_id, data) except EpepinException as ex: status_code = ex.get_status_code() message = ex.get_error_message() return Response.json_data(status_code, message, input_data, requirement_id)
def create_comment(): status_code = CODE_POST_OK message = MSG_POST_OK token = None comment = None try: if (__correct_token()): data = request.get_json() db = database_connection() connection = db.connection() comment = db.insert_comment(connection, data) except EpepinException as ex: status_code = ex.get_status_code() message = ex.get_error_message() return Response.json_data(status_code, message, None, None)