summaryrefslogtreecommitdiffstats
path: root/src/routes/home.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2023-12-12 18:20:56 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2023-12-12 18:20:56 +0000
commita587459a1817c0fc57b46df3f9c69567e1e775b7 (patch)
treeab99c6aaa7c2b3245c83db6332e4ca54006831b3 /src/routes/home.rs
parent370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0 (diff)
downloadpinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.tar.gz
pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.tar.bz2
pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.zip
refactor: separate model and controller
Diffstat (limited to 'src/routes/home.rs')
-rw-r--r--src/routes/home.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/routes/home.rs b/src/routes/home.rs
index 11d3a72..a43eabc 100644
--- a/src/routes/home.rs
+++ b/src/routes/home.rs
@@ -8,12 +8,7 @@ use crate::{Pinussy, Result};
async fn get(session: Session, state: web::Data<Pinussy>) -> Result<HttpResponse> {
let username: Option<String>;
if let Some(user_id) = session.get::<i32>("user_id")? {
- username = Some(
- sqlx::query!("select username from users where id = $1", user_id)
- .fetch_one(&state.db)
- .await?
- .username,
- )
+ username = Some(state.db.users().read(user_id).await?.username)
} else {
username = None
}