Removal of unused code or things that were trivial to switch to the library like db types
This commit is contained in:
@@ -9,11 +9,6 @@ use crate::{UBigInt, BigInt, VarChar};
|
||||
|
||||
use crate::common::{FromDB};
|
||||
|
||||
macro_rules! msg_channel {
|
||||
$(value:expr) => {
|
||||
format!("messages_{}", value)
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub struct Message {
|
||||
pub id: UBigInt,
|
||||
@@ -84,20 +79,3 @@ impl FromDB<Message> for Message {
|
||||
return Response::Other(no_conn!("Message::FromDB::update"))
|
||||
}
|
||||
}
|
||||
impl Message {
|
||||
async fn add(p: &Pool, author_id: UBigInt, content: VarChar, channel_id: UBigInt) -> Response<Self> {
|
||||
//! Adds a user message to the given channel via channel_id
|
||||
let conn = p.get_conn().await;
|
||||
if conn.is_err() {
|
||||
return Response::Other(no_conn!("Message::add"));
|
||||
}
|
||||
// generate the channel name
|
||||
let fq_channel_id = msg_channel!(channel_id);
|
||||
conn.prep_exec(
|
||||
"INSERT INTO :table (id, time, content, author_id)",
|
||||
params!{"cid" => fq_channel_id}
|
||||
);
|
||||
return Response::Success;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user