Refactor models names
This commit is contained in:
parent
76b14ce75b
commit
be7f31906c
24 changed files with 461 additions and 340 deletions
emgauwa-lib/src/handlers/v1/ws
|
@ -1,4 +1,4 @@
|
|||
use crate::db::Schedule;
|
||||
use crate::db::DbSchedule;
|
||||
use crate::handlers::errors::ApiError;
|
||||
use actix::{Actor, StreamHandler};
|
||||
use actix_web::{get, web, HttpRequest, HttpResponse};
|
||||
|
@ -15,10 +15,10 @@ impl Actor for ControllerWs {
|
|||
type Context = ws::WebsocketContext<Self>;
|
||||
}
|
||||
|
||||
async fn get_schedules(pool: &mut Pool<Sqlite>) -> Result<Vec<Schedule>, ApiError> {
|
||||
async fn get_schedules(pool: &mut Pool<Sqlite>) -> Result<Vec<DbSchedule>, ApiError> {
|
||||
let mut pool_conn = pool.acquire().await?;
|
||||
|
||||
Ok(Schedule::get_all(&mut pool_conn).await?)
|
||||
Ok(DbSchedule::get_all(&mut pool_conn).await?)
|
||||
}
|
||||
|
||||
impl StreamHandler<Result<Message, ProtocolError>> for ControllerWs {
|
||||
|
@ -28,9 +28,9 @@ impl StreamHandler<Result<Message, ProtocolError>> for ControllerWs {
|
|||
match msg {
|
||||
Ok(Message::Ping(msg)) => ctx.pong(&msg),
|
||||
Ok(Message::Text(text)) => {
|
||||
println!("Got text: {}", text.to_string());
|
||||
println!("Got text: {}", text);
|
||||
ctx.text(schedules_json)
|
||||
},
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue