fixed borrow/moving issue with create_channel call
removed some unsed variables
This commit is contained in:
parent
7fa103b1dc
commit
50962598e5
@ -162,7 +162,7 @@ fn parse_insert_channel_params(name: Option<&&str>, kind: Option<&&str>, desc: O
|
|||||||
}
|
}
|
||||||
async fn insert_channel(pool: &Pool, channel: InsertableChannel) -> Result<(), Error> {
|
async fn insert_channel(pool: &Pool, channel: InsertableChannel) -> Result<(), Error> {
|
||||||
let conn = pool.get_conn().await?;
|
let conn = pool.get_conn().await?;
|
||||||
let conn = conn.batch_exec(
|
conn.batch_exec(
|
||||||
r"INSERT INTO channels (name, kind, description) VALUES (:name, :kind, :description)",
|
r"INSERT INTO channels (name, kind, description) VALUES (:name, :kind, :description)",
|
||||||
params!{
|
params!{
|
||||||
"name" => channel.name,
|
"name" => channel.name,
|
||||||
@ -172,7 +172,7 @@ async fn insert_channel(pool: &Pool, channel: InsertableChannel) -> Result<(), E
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_channel(pool: &Pool, response: &Response<Body>, params: HashMap<&str, &str>) {
|
pub async fn create_channel(pool: &Pool, response: &mut Response<Body>, params: &HashMap<&str, &str>) {
|
||||||
/*
|
/*
|
||||||
* Create a channel base on a few parameters that may or may not be there
|
* Create a channel base on a few parameters that may or may not be there
|
||||||
*/
|
*/
|
||||||
@ -187,6 +187,6 @@ pub async fn create_channel(pool: &Pool, response: &Response<Body>, params: Hash
|
|||||||
Err(_) => *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR
|
Err(_) => *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => *response.status_mut() = StatusCode::BAD_REQUEST
|
Err(_) => *response.status_mut() = StatusCode::BAD_REQUEST
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user