diff --git a/json-api/src/channels.rs b/json-api/src/channels.rs
index 29ab0b5..fd3fb28 100644
--- a/json-api/src/channels.rs
+++ b/json-api/src/channels.rs
@@ -10,6 +10,7 @@ use db::{ self, Channel};
use crate::http::set_json_body;
use crate::qs_param;
+use crate::rtc;
pub async fn list_channels(pool: &Pool, response: &mut Response
, params: HashMap) {
@@ -58,6 +59,7 @@ pub async fn create_channel(pool: &Pool, response: &mut Response, params:
match resp {
Row(channel) => {
set_json_body(response, json!(channel));
+ rtc::create_channel(channel).await;
StatusCode::OK
},
@@ -112,7 +114,9 @@ pub async fn delete_channel(pool: &Pool, response: &mut Response, params:
if let Some(id) = channel_id {
match Channel::delete(pool, id).await {
- Ok(Success) => {/* nothing to do on sucess */},
+ Ok(Success) => {
+ rtc::delete_channel(id).await;
+ },
Ok(_) => {/* can't actually happen */}
Err(e) => { // ngmi
eprintln!("{}", e);
diff --git a/json-api/src/main.rs b/json-api/src/main.rs
index 988713c..a0c6e8c 100644
--- a/json-api/src/main.rs
+++ b/json-api/src/main.rs
@@ -117,7 +117,7 @@ async fn main_responder(request: Request) -> Result, hyper:
route_dispatcher(&DB_POOL, &mut response, &method, path, body, params, headers).await;
},
LoginValid => {
- auth::login_get_jwt(&DB_POOL, &mut response, params).await;
+ auth::login_get_jwt(&mut response, params).await;
},
NoKey | BadKey => {
println!("[DEBUG] NoKey | BadKey");
diff --git a/json-api/src/members.rs b/json-api/src/members.rs
index 84b5556..1939b97 100644
--- a/json-api/src/members.rs
+++ b/json-api/src/members.rs
@@ -9,6 +9,7 @@ use db::Response::*;
use crate::http::set_json_body;
use crate::qs_param;
+use crate::rtc;
pub async fn get_online_members(p: &Pool, response: &mut Response) {
@@ -69,7 +70,10 @@ pub async fn post_self_nickname(p: &Pool, response: &mut Response, params:
let uid = qs_param!(params, "id", u64).unwrap();
match Member::update_nick(p, uid, nick.as_ref()).await {
- Ok(_) => StatusCode::OK,
+ Ok(_) => {
+ rtc::update_nickname(uid, nick.as_str()).await;
+ StatusCode::OK
+ },
Err(e) => {
eprintln!("{}", e);
StatusCode::INTERNAL_SERVER_ERROR
diff --git a/json-api/src/messages.rs b/json-api/src/messages.rs
index 50a0df1..20d9744 100644
--- a/json-api/src/messages.rs
+++ b/json-api/src/messages.rs
@@ -81,7 +81,10 @@ pub async fn send_message(pool: &Pool, response: &mut Response, body: Body
Row(user) => user.permissions,
_ => 0
},
- Err(e) => 0
+ Err(e) => {
+ eprintln!("[DB-SQL] {}",e );
+ 0
+ }
};
if perms::has_perm(permissions, perms::SEND_MESSAGES) == false {
*response.status_mut() = StatusCode::BAD_REQUEST;