summaryrefslogtreecommitdiff
path: root/src/serve.rs
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2020-02-13 00:37:44 +0000
committerDennis Kobert <dennis@kobert.dev>2020-02-13 00:37:44 +0000
commita1297dd77fff5882c6dd1891775739ea38a33b62 (patch)
tree04f5afea8b4bbd3c6d8f68b58ba3e03bd3c7d3ef /src/serve.rs
parent05e6080ddad91ac96bb5921e77b2ff78648ff275 (diff)
Add styling, user request
Diffstat (limited to 'src/serve.rs')
-rw-r--r--src/serve.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/serve.rs b/src/serve.rs
index 08f3f8b..ade84ca 100644
--- a/src/serve.rs
+++ b/src/serve.rs
@@ -220,3 +220,14 @@ pub fn match_users(name1: String, name2: String) -> Result<String, status::NotFo
}
Ok(songs)
}
+
+#[get("/user")]
+pub fn get_users() -> Result<String, status::NotFound<String>> {
+ let mut client = crate::CLIENT.lock().unwrap();
+ let mut users = String::new();
+ for row in client.query("SELECT user_name FROM suser", &[]).unwrap() {
+ let user: String = row.get(0);
+ users = format!("{}{}\n", users, user);
+ }
+ Ok(users)
+}