예제 #1
0
def create_startup():
    user_id = getUserID('me')
    try:
        new_startup = startup.create_startup(user_id, request.get_json())
        return jsonify(startup.get_basic_startup(new_startup, getUserID('me')))
    except Exception as e:
        return jsonify({'error': str(e)}), HTTP_400_BAD_REQUEST
def create_startup():
    user_id = getUserID('me')
    try:
        new_startup = startup.create_startup(user_id, request.get_json())
        return jsonify(startup.get_basic_startup(new_startup, getUserID('me')))
    except Exception as e:
        return jsonify({'error': str(e)}), HTTP_400_BAD_REQUEST
def get_basic_startup(startup_id):
    startup_object = startup.find_startup_by_id(startup_id)

    if startup_object is None:
        return jsonify({'error': 'Not found'}), HTTP_404_NOT_FOUND

    try:
        return jsonify(startup.get_basic_startup(startup_object, getUserID('me')))
    except Exception as e:
        return jsonify({'error': str(e)}), HTTP_400_BAD_REQUEST
예제 #4
0
def get_basic_startup(startup_id):
    startup_object = startup.find_startup_by_id(startup_id)

    if startup_object is None:
        return jsonify({'error': 'Not found'}), HTTP_404_NOT_FOUND

    try:
        return jsonify(
            startup.get_basic_startup(startup_object, getUserID('me')))
    except Exception as e:
        return jsonify({'error': str(e)}), HTTP_400_BAD_REQUEST
예제 #5
0
def update_basic_startup(startup_id):
    startup_object = startup.find_startup_by_id(startup_id)
    user_id = getUserID('me')

    no = not_owned(startup_object)
    if not no is None:
        return no

    try:
        startup.update_basic_startup(startup_object, request.get_json())
        return jsonify(startup.get_basic_startup(startup_object, user_id))
    except Exception as e:
        return jsonify({'error': str(e)}), HTTP_400_BAD_REQUEST
def update_basic_startup(startup_id):
    startup_object = startup.find_startup_by_id(startup_id)
    user_id = getUserID('me')

    no = not_owned(startup_object)
    if not no is None:
        return no

    try:
        startup.update_basic_startup(startup_object, request.get_json())
        return jsonify(startup.get_basic_startup(startup_object, user_id))
    except Exception as e:
        return jsonify({'error': str(e)}), HTTP_400_BAD_REQUEST