def delete_reservation_customer(id, customer_id):
    """Given a customer and a reservation id,
    this function delete the reservation from the database.

    Args:
        id (int): univocal identifier for the reservation

    Returns:
        Redirects the view to the customer profile page.
    """
    ReservationManager.delete_reservation_by_id(id)
    return redirect(url_for('auth.profile', id=customer_id))
def delete_reservation(id, restaurant_id):
    """This method deletes a specific reservation for a restaurant

    Args:
        id (int): univocal identifier of the reservation
        restaurant_id (int): univocal identifier of the restaurant

    Returns:
        Redirects the view to the general page of the reservation
    """
    ReservationManager.delete_reservation_by_id(id)
    return redirect(
        url_for('reservation.reservation_all', restaurant_id=restaurant_id))
Esempio n. 3
0
def delete_reservation(reservation_id):
    """This method is used to delete a reservation
        Linked to route /reservation/{reservation_id} [DELETE]
    Args:
        reservation_id (int): univocal identifier of the reservation
    Returns: 
        Invalid request if the deletion of the reservation is not successful
        A json specifying the info needed to render the reservation page otherwise
    """
    try:
        ReservationManager.delete_reservation_by_id(reservation_id)
    except Exception as e:
        return jsonify({
            'message': 'Error during avg stay updating\n' + str(e),
            'status': 'Internal Server Error'
        }), 500
    return jsonify({'message': 'Restaurant successfully deleted'}), 200