From ad0e585abed7a189b6117e9187c9afff809d1414 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 8 Apr 2019 15:55:14 +0200 Subject: Move functions to query/modify db to connection object. Makes tha API a bit nicer by asking the database rather than passing the database on to each model. Reserve models for method/functions that work on the model structs themselves. --- src/controllers/screening.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/controllers/screening.rs') diff --git a/src/controllers/screening.rs b/src/controllers/screening.rs index d060eb7..622e9cb 100644 --- a/src/controllers/screening.rs +++ b/src/controllers/screening.rs @@ -18,7 +18,7 @@ use crate::{ db, - models::{screening::{self, Screening}, film::Film, room::Room}, + models::{screening::Screening, film::Film, room::Room}, }; use rocket::get; @@ -28,5 +28,5 @@ use rocket_contrib::{ #[get("/")] pub fn get_screenings(db: db::Connection) -> Json, Option)>> { - Json(screening::get_all(&db).unwrap()) + Json(db.get_screenings().unwrap()) } -- cgit v1.2.3