Пример #1
0
def delete(aid):
    """
    /api/addresses/{aid}
    Delete addresses identified by aid

    :param aid:    new address information
    :return:       the deleted address
    """
    try:
        address = Address.get(Address.id == aid)
    except:
        abort(404, f"Email with id {aid} not found")

    address.delete_instance()

    return address.serialize()
Пример #2
0
def update(aid, address):
    """
    /api/addresses/{aid}
    Update address identified by aid
   
    :param aid:     id of the address to retrieve
    :param address: new address information
    :return:       the new address object
    """
    try:
        theAddress = Address.get(Address.id == aid)
    except DoesNotExist:
        abort(404, f"Address with id {aid} for contact {cid} not found")
    theAddress.full_address = address.get("address")
    theAddress.save()

    return theAddress.serialize()