-* Removing ugle tuple indexing with some cleaner binds

- Removing warning of unused var
+ Adding 404 response to /badge/update/name when the badge_id isn't real
This commit is contained in:
shockrah
2021-06-07 23:55:12 -07:00
parent b289f5c811
commit 0e607eac1d
2 changed files with 8 additions and 7 deletions

View File

@@ -37,12 +37,12 @@ async fn get(pool: &Pool, id: u64) -> SqlResult<Option<Badge>> {
let q = "SELECT name, color, permissions FROM badges WHERE id = :id";
let row: Option<(String, u32, u64)> = conn.exec_first(q, params!{ "id" => id}).await?;
match row {
Some(row) => {
Some((name, color, perms)) => {
let b = Badge {
id,
name: row.0,
color: row.1,
perms: row.2,
name,
color,
perms
};
Ok(Some(b))
},