예제 #1
0
def get_user(user_id):

    result = Users.get_users_by_id(user_id)
    if not result:
        return make_response(jsonify({'error': 'User not found'}), 404)

    return result.to_json()
예제 #2
0
def update_user(user_id):
    """
    Update user specified with user ID and return updated user contents
    Note: Always return the appropriate response for the action requested.
    """

    if Users.update_user(user_id, request) != 0:
        return Users.get_users_by_id(user_id).to_json()
    else:
        return make_response(jsonify({'error': 'User not found'}), 404)