From caa7b4429e68135404ad5a01aa1d7f530abae090 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 28 Apr 2019 13:47:58 +0200 Subject: Update /screenings endpoint to return full info on screenings. This makes each screening record self-contained, and the json payload more consistent with how it semantically fit together. --- src/db.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/db.rs') diff --git a/src/db.rs b/src/db.rs index d7a12b0..d24384f 100644 --- a/src/db.rs +++ b/src/db.rs @@ -53,12 +53,13 @@ impl Connection { .execute(&**self) } - pub fn get_screenings(&self) -> QueryResult, Option)>> { + pub fn get_screenings(&self) -> QueryResult> { use crate::schema::screenings::dsl::*; - screenings + let s = screenings .left_join(films::table) .left_join(rooms::table) - .get_results(&**self) + .get_results(&**self)?; + Ok(models::Screening::from_query(s)) } pub fn get_rooms(&self) -> QueryResult> { -- cgit v1.2.3