added delete method for messages
This commit is contained in:
parent
2642fdb8b3
commit
65532def98
@ -66,7 +66,6 @@ impl FromDB<Member> for Member {
|
||||
if let Ok(conn) = p.get_conn().await {
|
||||
match Member::get(p, row.id).await {
|
||||
Response::Row(_) => {
|
||||
// update now
|
||||
let db_result: Result<Conn, SqlError>
|
||||
= conn.drop_exec(q, params!{
|
||||
"id" => row.id,
|
||||
|
@ -62,6 +62,15 @@ impl FromDB<Message> for Message {
|
||||
}
|
||||
|
||||
async fn delete(p: &Pool, id: UBigInt) -> Response<Self> {
|
||||
unimplemented!()
|
||||
if let Ok(conn) = p.get_conn().await {
|
||||
let q = "DELETE FROM messages WHERE id = :id";
|
||||
let result: Result<Conn, SqlError> =
|
||||
conn.drop_exec(q, params!{"id" => id}).await;
|
||||
return match result {
|
||||
Ok(_) => Response::Success,
|
||||
Err(_) => Response::Other(sql_err!("Message::FromDB::delete"))
|
||||
}
|
||||
}
|
||||
return Response::Other(no_conn!("Message::FromDB::update"))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user