aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/screening.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/screening.rs')
-rw-r--r--src/models/screening.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/models/screening.rs b/src/models/screening.rs
index 4ae42a2..feb98cc 100644
--- a/src/models/screening.rs
+++ b/src/models/screening.rs
@@ -44,8 +44,9 @@ pub struct ScreeningRecord {
pub end_time: chrono::NaiveTime,
}
+/// Aggregate screening, room and film info into one struct.
#[derive(Deserialize, Serialize)]
-pub struct Screening {
+pub struct AggregatedScreening {
pub id: i32,
pub film: Film,
pub room: Room,
@@ -54,10 +55,10 @@ pub struct Screening {
pub end_time: chrono::NaiveTime,
}
-impl Screening {
- pub fn from_query(s: Vec<(ScreeningRecord, Option<Film>, Option<Room>)>) -> Vec<Screening> {
+impl AggregatedScreening {
+ pub fn from_query(s: Vec<(ScreeningRecord, Option<Film>, Option<Room>)>) -> Vec<AggregatedScreening> {
s.iter().map(|(s, f, r)| {
- Screening {
+ AggregatedScreening {
id: s.id,
film: f.as_ref().unwrap().clone().to_owned(),
room: r.as_ref().unwrap().clone().to_owned(),