|
|
@ -144,7 +144,7 @@ def create_group(): |
|
|
|
id=new_group.id) |
|
|
|
id=new_group.id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@groups.route('<group_id>/', methods=['PUT']) |
|
|
|
@groups.route('<int:group_id>/', methods=['PUT']) |
|
|
|
@ForceJSON() |
|
|
|
@ForceJSON() |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def update_group(group_id): |
|
|
|
def update_group(group_id): |
|
|
@ -204,7 +204,7 @@ def update_group(group_id): |
|
|
|
return jsonify(status='OK') |
|
|
|
return jsonify(status='OK') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@groups.route('<group_id>/', methods=['DELETE']) |
|
|
|
@groups.route('<int:group_id>/', methods=['DELETE']) |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def delete_group(group_id): |
|
|
|
def delete_group(group_id): |
|
|
|
"""*Authenticated request* |
|
|
|
"""*Authenticated request* |
|
|
@ -243,7 +243,7 @@ def delete_group(group_id): |
|
|
|
group_users = Blueprint('group_users', __name__) |
|
|
|
group_users = Blueprint('group_users', __name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@group_users.route('<group_id>/users/', methods=['PUT']) |
|
|
|
@group_users.route('<int:group_id>/users/', methods=['PUT']) |
|
|
|
@ForceJSON(required=['usernames']) |
|
|
|
@ForceJSON(required=['usernames']) |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def add_users_to_group(group_id): |
|
|
|
def add_users_to_group(group_id): |
|
|
@ -304,7 +304,7 @@ def add_users_to_group(group_id): |
|
|
|
not_found=unknown) |
|
|
|
not_found=unknown) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@group_users.route('<group_id>/users/', methods=['GET']) |
|
|
|
@group_users.route('<int:group_id>/users/', methods=['GET']) |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def list_group_members(group_id): |
|
|
|
def list_group_members(group_id): |
|
|
|
"""*Authenticated request* |
|
|
|
"""*Authenticated request* |
|
|
@ -359,7 +359,7 @@ def list_group_members(group_id): |
|
|
|
group_places = Blueprint('group_places', __name__) |
|
|
|
group_places = Blueprint('group_places', __name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@group_places.route('<group_id>/places/', methods=['GET']) |
|
|
|
@group_places.route('<int:group_id>/places/', methods=['GET']) |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def get_group_places(group_id): |
|
|
|
def get_group_places(group_id): |
|
|
|
"""*Authenticated request* |
|
|
|
"""*Authenticated request* |
|
|
@ -407,7 +407,7 @@ def get_group_places(group_id): |
|
|
|
places=places) |
|
|
|
places=places) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@group_places.route('<group_id>/places/', methods=['POST']) |
|
|
|
@group_places.route('<int:group_id>/places/', methods=['POST']) |
|
|
|
@ForceJSON(required=['places']) |
|
|
|
@ForceJSON(required=['places']) |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def group_add_places(group_id): |
|
|
|
def group_add_places(group_id): |
|
|
@ -477,7 +477,8 @@ def group_add_places(group_id): |
|
|
|
rejected=rejected) |
|
|
|
rejected=rejected) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@group_places.route('<group_id>/places/<place_id>/', methods=['DELETE']) |
|
|
|
@group_places.route('<int:group_id>/places/<int:place_id>/', |
|
|
|
|
|
|
|
methods=['DELETE']) |
|
|
|
@auth |
|
|
|
@auth |
|
|
|
def group_remove_place(group_id, place_id): |
|
|
|
def group_remove_place(group_id, place_id): |
|
|
|
"""*Authenticated request* |
|
|
|
"""*Authenticated request* |
|
|
@ -504,10 +505,17 @@ def group_remove_place(group_id, place_id): |
|
|
|
if not group: |
|
|
|
if not group: |
|
|
|
raise ElementNotFoundException('Group') |
|
|
|
raise ElementNotFoundException('Group') |
|
|
|
|
|
|
|
|
|
|
|
index = None |
|
|
|
index = -1 |
|
|
|
try: |
|
|
|
LOG.debug('Places: {places}'.format(places=group.places)) |
|
|
|
index = group.places.index(place_id) |
|
|
|
for (pos, place) in enumerate(group.places): |
|
|
|
except ValueError: |
|
|
|
LOG.debug('Place {pos} = {place} (search {search})'.format( |
|
|
|
|
|
|
|
pos=pos, place=place.id, search=place_id)) |
|
|
|
|
|
|
|
if place.id == place_id: |
|
|
|
|
|
|
|
index = pos |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG.debug('Index: {index}'.format(index=index)) |
|
|
|
|
|
|
|
if index == -1: |
|
|
|
raise ElementNotFoundException('Place') |
|
|
|
raise ElementNotFoundException('Place') |
|
|
|
|
|
|
|
|
|
|
|
del group.places[index] |
|
|
|
del group.places[index] |
|
|
|