Removing double log issue with client-tester

 Moving Messages struct in db-lib to root for less namespacing uglyness
 Removing an whole unused trait
 Message::get_time_range now returns a special 'UserMessage' struct that includes the name of the author
 More code must be removed from db-lib since a ton of the trait methods aren't used anymore
This commit is contained in:
shockrah
2021-03-07 13:29:10 -08:00
parent a6e3f22eae
commit 12936d5b1a
4 changed files with 34 additions and 123 deletions

View File

@@ -8,7 +8,7 @@ use std::collections::HashMap;
use crate::http::set_json_body;
use crate::perms;
use crate::qs_param;
use db::messages::Message;
use db::Message;
pub async fn get_by_time(pool: &Pool, response: &mut Response<Body>, params: HashMap<String, String>) {
/*
@@ -87,7 +87,7 @@ pub async fn send_message(pool: &Pool, response: &mut Response<Body>, body: Body
if content.len() == 0 || channel_id.is_none() {
*response.status_mut() = StatusCode::BAD_REQUEST;
} else {
match db::messages::Message::send(pool, &content, channel_id.unwrap(), uid).await {
match db::Message::send(pool, &content, channel_id.unwrap(), uid).await {
Ok(Empty) => {}, // nothing to do hyper defaults to 200
Ok(RestrictedInput(_msg)) => *response.status_mut() = StatusCode::BAD_REQUEST,
Ok(Other(msg)) => {