From 523985ce61f6989e955c8ea4a9ab9a7a3e227b36 Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 10 Jul 2020 19:54:41 -0700 Subject: [PATCH] removed unused struct MsgParam --- server/src/messages.rs | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/server/src/messages.rs b/server/src/messages.rs index b74fbc5..cce3b14 100644 --- a/server/src/messages.rs +++ b/server/src/messages.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; use mysql_async::{Conn, Pool, params}; use mysql_async::prelude::{Queryable}; use mysql_async::error::Error; -use hyper::{Response, Body}; +use hyper::{Response, Body, StatusCode}; use serde_json::Value; use chrono::Utc; @@ -18,26 +18,6 @@ struct Message { channel: Channel } -enum MsgParam { - Good, - Incomplete, - Empty -} -impl MsgParam { - fn is_good(&self) -> bool { - match self { - Good => true, - _ => false - } - } - - fn is_empty(&self) -> bool { - match self { - Empty => true, - _ => false, - } - } -} fn validate_params(p: &Value, keys: Vec<&str>) -> bool { let mut fail = false; @@ -111,10 +91,8 @@ pub async fn send_message(pool: &Pool, response: &mut Response, params: Va let id = params.get("id").unwrap().as_u64(); let secret: &str = params.get("secret").unwrap().as_str().unwrap(); //auth sucess guarantees this param is fine match update_messages_table(pool, secret, content, id).await { - Ok(_) => { - }, - Err(err) => { - } + Ok(_) => *response.status_mut() = StatusCode::OK, + Err(_err) => *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR } } } \ No newline at end of file