Skip to content

Commit

Permalink
new delete of address
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 18, 2016
1 parent bffe34c commit be53003
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/budy/controllers/api/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,12 @@ def create_address_me(self):
account.save()
address = address.map()
return address

@appier.route("/api/accounts/me/addresses/<str:key>", "DELETE", json = True)
@appier.ensure(token = "user")
def delete_address_me(self, key):
address = budy.Address.get(key = key)
account = budy.BudyAccount.from_session(rules = False)
account.addresses.remove(address.id)
account.save()
address.delete()
5 changes: 5 additions & 0 deletions src/budy/controllers/api/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ def update(self, key):
address.save()
address = address.map()
return address

@appier.route("/api/addresses/<str:key>", "DELETE", json = True)
def delete(self, key):
address = budy.Address.get(key = key)
address.delete()

0 comments on commit be53003

Please sign in to comment.