Can generate calendars
This commit is contained in:
@@ -485,6 +485,12 @@ pub struct NewAccommodation {
|
||||
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, Eq, PartialEq, Hash)]
|
||||
pub struct AccommodationReservationID(pub i32);
|
||||
|
||||
pub enum ReservationStatus {
|
||||
Pending,
|
||||
Accepted,
|
||||
Rejected,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug, serde::Serialize)]
|
||||
pub struct AccommodationReservation {
|
||||
id: i32,
|
||||
@@ -514,6 +520,14 @@ impl AccommodationReservation {
|
||||
pub fn user_id(&self) -> UserID {
|
||||
UserID(self.user_id)
|
||||
}
|
||||
|
||||
pub fn status(&self) -> ReservationStatus {
|
||||
match self.validated {
|
||||
None => ReservationStatus::Pending,
|
||||
Some(true) => ReservationStatus::Accepted,
|
||||
Some(false) => ReservationStatus::Rejected,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
|
||||
Reference in New Issue
Block a user