removed unused struct MsgParam
This commit is contained in:
parent
cdc2f0a13a
commit
523985ce61
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
|||||||
use mysql_async::{Conn, Pool, params};
|
use mysql_async::{Conn, Pool, params};
|
||||||
use mysql_async::prelude::{Queryable};
|
use mysql_async::prelude::{Queryable};
|
||||||
use mysql_async::error::Error;
|
use mysql_async::error::Error;
|
||||||
use hyper::{Response, Body};
|
use hyper::{Response, Body, StatusCode};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
|
||||||
@ -18,26 +18,6 @@ struct Message {
|
|||||||
channel: Channel
|
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 {
|
fn validate_params(p: &Value, keys: Vec<&str>) -> bool {
|
||||||
let mut fail = false;
|
let mut fail = false;
|
||||||
@ -111,10 +91,8 @@ pub async fn send_message(pool: &Pool, response: &mut Response<Body>, params: Va
|
|||||||
let id = params.get("id").unwrap().as_u64();
|
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
|
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 {
|
match update_messages_table(pool, secret, content, id).await {
|
||||||
Ok(_) => {
|
Ok(_) => *response.status_mut() = StatusCode::OK,
|
||||||
},
|
Err(_err) => *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR
|
||||||
Err(err) => {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user