def delete(id_: str, dao: GenericSQLDAO): entity = dao.get(id_=id_) if not entity: return error_response(status_code=404, message="EntityForTest not found", data={"id_": id_}) dao.remove(entity) return success_response(message="EntityForTest deleted", data={"EntityForTest": dict(entity)})
def delete(id_: str, phone_id: str, dao: GenericSQLDAO): entity = dao.get(id_=phone_id) if entity.contact.id_ != id_: entity = None if not entity: return error_response(status_code=404, message="Phone not found", data={"id_": id_}) dao.remove(entity) return success_response(message="Phone deleted", data={"Phone": dict(entity)})