add weather infos
This commit is contained in:
@ -6,6 +6,7 @@ use self::{
|
||||
planned_event::{PlannedEvent, PlannedEventWithUserAndTriptype},
|
||||
trip::{Trip, TripWithUserAndType},
|
||||
waterlevel::Waterlevel,
|
||||
weather::Weather,
|
||||
};
|
||||
|
||||
pub mod boat;
|
||||
@ -29,6 +30,7 @@ pub mod triptype;
|
||||
pub mod user;
|
||||
pub mod usertrip;
|
||||
pub mod waterlevel;
|
||||
pub mod weather;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Day {
|
||||
@ -37,6 +39,7 @@ pub struct Day {
|
||||
trips: Vec<TripWithUserAndType>,
|
||||
is_pinned: bool,
|
||||
max_waterlevel: Option<i64>,
|
||||
weather: Option<Weather>,
|
||||
}
|
||||
|
||||
impl Day {
|
||||
@ -48,6 +51,7 @@ impl Day {
|
||||
trips: Trip::get_pinned_for_day(db, day).await,
|
||||
is_pinned,
|
||||
max_waterlevel: Waterlevel::max_waterlevel_for_day(db, day).await,
|
||||
weather: Weather::find_by_day(db, day).await,
|
||||
}
|
||||
} else {
|
||||
Self {
|
||||
@ -56,6 +60,7 @@ impl Day {
|
||||
trips: Trip::get_for_day(db, day).await,
|
||||
is_pinned,
|
||||
max_waterlevel: Waterlevel::max_waterlevel_for_day(db, day).await,
|
||||
weather: Weather::find_by_day(db, day).await,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user