diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-08-23 17:06:24 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-08-23 17:06:24 +0200 |
commit | d3a6a99e9c1751ec08bed526d4ce7237425cdf73 (patch) | |
tree | 1a045f2d0059610a5bc60d200f6becf309a211a8 /src/models | |
parent | 0a2d6fc06fc1988f860ab81fe53d1e6dae470407 (diff) | |
download | ramaskrik-social-d3a6a99e9c1751ec08bed526d4ce7237425cdf73.tar.gz ramaskrik-social-d3a6a99e9c1751ec08bed526d4ce7237425cdf73.tar.bz2 ramaskrik-social-d3a6a99e9c1751ec08bed526d4ce7237425cdf73.zip |
Change start/end times to complete timestamps.
The way we had this until now with a date and separate start and end
times does not really work. There are cases when a screening starts on
one day, but ends on the next. By keeping a complete timestamp for both
the start and end times, we don't fall into this problem.
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/screening.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/models/screening.rs b/src/models/screening.rs index b111218..1426605 100644 --- a/src/models/screening.rs +++ b/src/models/screening.rs @@ -28,9 +28,8 @@ joinable!(screenings -> films (film_id)); pub struct NewScreening { pub film_id: i32, pub room_id: i32, - pub date: chrono::NaiveDate, - pub start_time: chrono::NaiveTime, - pub end_time: chrono::NaiveTime, + pub start_time: chrono::DateTime<chrono::Utc>, + pub end_time: chrono::DateTime<chrono::Utc>, } #[derive(Deserialize, Identifiable, PartialEq, Serialize, Queryable)] @@ -39,9 +38,8 @@ pub struct Screening { pub id: i32, pub film_id: i32, pub room_id: i32, - pub date: chrono::NaiveDate, - pub start_time: chrono::NaiveTime, - pub end_time: chrono::NaiveTime, + pub start_time: chrono::DateTime<chrono::Utc>, + pub end_time: chrono::DateTime<chrono::Utc>, } /// Aggregate screening, room and film info into one struct. @@ -50,9 +48,8 @@ pub struct AggregatedScreening { pub id: i32, pub film: Film, pub room: Room, - pub date: chrono::NaiveDate, - pub start_time: chrono::NaiveTime, - pub end_time: chrono::NaiveTime, + pub start_time: chrono::DateTime<chrono::Utc>, + pub end_time: chrono::DateTime<chrono::Utc>, } impl AggregatedScreening { @@ -62,7 +59,6 @@ impl AggregatedScreening { id: s.id, film: f.as_ref().unwrap().clone().to_owned(), room: r.as_ref().unwrap().clone().to_owned(), - date: s.date, start_time: s.start_time, end_time: s.end_time, } |