diff options
author | cel 🌸 <cel@blos.sm> | 2023-12-12 18:20:56 +0000 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-12-12 18:20:56 +0000 |
commit | a587459a1817c0fc57b46df3f9c69567e1e775b7 (patch) | |
tree | ab99c6aaa7c2b3245c83db6332e4ca54006831b3 /src/routes/users.rs | |
parent | 370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0 (diff) | |
download | pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.tar.gz pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.tar.bz2 pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.zip |
refactor: separate model and controller
Diffstat (limited to '')
-rw-r--r-- | src/routes/users.rs | 7 |
1 files changed, 1 insertions, 6 deletions
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<Pinussy>) -> Result<HttpResponse> { - let users: Vec<User> = sqlx::query_as("select * from users") - .fetch_all(&state.db) - .await - // TODO: no unwrap - .unwrap(); - println!("lol"); + let users: Vec<User> = state.db.users().read_all().await?; Ok(HttpResponse::Ok().body(render!(templates::users_html, users).unwrap())) } |