Can delete a reservation
This commit is contained in:
@ -37,6 +37,20 @@ pub async fn update(r: &mut AccommodationReservation) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete a reservation
|
||||
pub async fn delete(r: AccommodationReservation) -> anyhow::Result<()> {
|
||||
// Remove the reservation
|
||||
db_connection::execute(|conn| {
|
||||
diesel::delete(
|
||||
accommodations_reservations::dsl::accommodations_reservations
|
||||
.filter(accommodations_reservations::dsl::id.eq(r.id().0)),
|
||||
)
|
||||
.execute(conn)
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get all the reservations of an accommodation
|
||||
pub async fn get_all_of_accommodation(
|
||||
id: AccommodationID,
|
||||
|
Reference in New Issue
Block a user