示例#1
0
文件: routes.py 项目: anapgg/eppin
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)
示例#2
0
文件: routes.py 项目: anapgg/eppin
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)
示例#3
0
文件: routes.py 项目: anapgg/eppin
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)
示例#4
0
文件: routes.py 项目: anapgg/eppin
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)
示例#5
0
文件: routes.py 项目: anapgg/eppin
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)
示例#6
0
文件: routes.py 项目: anapgg/eppin
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)