Example #1
0
def delete_user(id):

    result = UserService.get_by_id(id)

    if result is not None:
        if len(UserService.get_all()) > 1:
            UserService.remove(id)
            return ResponseHelper.response_204()
        else:
            return ResponseHelper.response_406('Must exists at least one user')
    else:
        return ResponseHelper.response_404('User not found')
Example #2
0
def list_users():

    return ResponseHelper.response_200(
        list(map(lambda x: x.to_json(), UserService.get_all())))