From b4a8149dc6ed595c0bd95f5824f7048799989bdb Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 21 Mar 2019 10:39:16 +0100 Subject: Actually fetch available rooms from the database. --- src/controllers/room.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/controllers') diff --git a/src/controllers/room.rs b/src/controllers/room.rs index 27f6a41..df77414 100644 --- a/src/controllers/room.rs +++ b/src/controllers/room.rs @@ -16,14 +16,17 @@ along with this program. If not, see . */ -use crate::db; +use crate::{ + db, + models::room, +}; + use rocket::get; use rocket_contrib::{ - json, - json::JsonValue, + json::Json, }; #[get("/")] -pub fn get_rooms(_db: db::Connection) -> JsonValue { - json!([]) +pub fn get_rooms(db: db::Connection) -> Json> { + Json(room::get_all(&db).unwrap()) } -- cgit v1.2.3