예제 #1
0
def delete(eid):
    """
    /api/emails/{eid}
    Delete email identified by eid

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

    email.delete_instance()

    return email.serialize()
예제 #2
0
def update(eid, email):
    """
    /api/emails/{eid}
    Update email identified by eid
   
    :param eid:    id of the email to retrieve
    :param email:  new email information
    :return:       the new email information
    """
    try:
        theEmail = Email.get(Email.id == eid)
    except DoesNotExist:
        abort(404, f"Email with ie {eid} for contact {cid} not found")
    theEmail.email = email.get("email")
    theEmail.save()

    return theEmail.serialize()