From a587459a1817c0fc57b46df3f9c69567e1e775b7 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 12 Dec 2023 18:20:56 +0000 Subject: refactor: separate model and controller --- src/routes/users.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/routes/users.rs') diff --git a/src/routes/users.rs b/src/routes/users.rs index 2ad9ede..eb08ade 100644 --- a/src/routes/users.rs +++ b/src/routes/users.rs @@ -6,11 +6,6 @@ use crate::{Pinussy, Result}; #[get("/users")] async fn get(state: web::Data) -> Result { - let users: Vec = sqlx::query_as("select * from users") - .fetch_all(&state.db) - .await - // TODO: no unwrap - .unwrap(); - println!("lol"); + let users: Vec = state.db.users().read_all().await?; Ok(HttpResponse::Ok().body(render!(templates::users_html, users).unwrap())) } -- cgit