More linting.
This commit is contained in:
1 parent
f4170610b0
commit
feaab2e843
5 files changed
+26
-33
No files matched your search
+4
-11
@@ -24,13 +24,6 @@ use crate::webui::worker::{bob, event_processor_loop};
|
||||
mod views;
|
||||
mod worker;
|
||||
|
||||
struct Service {}
|
||||
|
||||
impl Service {
|
||||
fn get_users(self) -> Vec<String> {
|
||||
vec!["to".to_string(), "foo".to_string()]
|
||||
}
|
||||
}
|
||||
|
||||
struct MiniJinjaRenderer {
|
||||
tmpl_env: web::Data<minijinja_autoreload::AutoReloader>,
|
||||
@@ -84,7 +77,7 @@ fn create_auto_reloader(enable_template_autoreload: bool) -> AutoReloader {
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn web_ui_main(
|
||||
connFact: SQLiteConnectionFactory,
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
port: u16,
|
||||
enable_template_autoreload: bool,
|
||||
) -> CustomResult<()> {
|
||||
@@ -95,12 +88,12 @@ pub async fn web_ui_main(
|
||||
|
||||
let tmpl_reloader = web::Data::new(tmpl_reloader);
|
||||
|
||||
let clonedConnFact = connFact.clone();
|
||||
let cloned_conn_fact = conn_fact.clone();
|
||||
let server = HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(tmpl_reloader.clone())
|
||||
.app_data(web::Data::new(event_sender.clone()))
|
||||
.app_data(web::Data::new(clonedConnFact.clone()))
|
||||
.app_data(web::Data::new(cloned_conn_fact.clone()))
|
||||
.service(
|
||||
actix_files::Files::new("/static", "./resources/static/").use_last_modified(true),
|
||||
)
|
||||
@@ -120,7 +113,7 @@ pub async fn web_ui_main(
|
||||
.unwrap();
|
||||
|
||||
let t1 = server.run().fuse();
|
||||
let t2 = event_processor_loop(connFact, event_receiver).fuse();
|
||||
let t2 = event_processor_loop(conn_fact, event_receiver).fuse();
|
||||
let t3 = bob().fuse();
|
||||
pin_mut!(t1, t2, t3);
|
||||
|
||||
|
||||
+2
-2
@@ -25,9 +25,9 @@ pub async fn actions(tmpl_env: MiniJinjaRenderer) -> actix_web::Result<impl Resp
|
||||
#[actix_web::get("/overview")]
|
||||
pub async fn overview(
|
||||
tmpl_env: MiniJinjaRenderer,
|
||||
connFactory: web::Data<SQLiteConnectionFactory>,
|
||||
conn_factory: web::Data<SQLiteConnectionFactory>,
|
||||
) -> actix_web::Result<impl Responder> {
|
||||
let conn = connFactory.readonly().unwrap(); // todo; to proper 500
|
||||
let conn = conn_factory.readonly().unwrap(); // todo; to proper 500
|
||||
let service_factory = ServiceFactory::new(&conn);
|
||||
let user_service = service_factory.get_user_service();
|
||||
let users = user_service.list_users().unwrap();
|
||||
|
||||
+2
-2
@@ -11,12 +11,12 @@ use crate::util::{CustomResult, SQLiteConnectionFactory};
|
||||
|
||||
// todo, all the "?" and handle the exceptions for real
|
||||
pub async fn event_processor_loop(
|
||||
conFact: SQLiteConnectionFactory,
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
r: async_channel::Receiver<Event>,
|
||||
) -> CustomResult<()> {
|
||||
loop {
|
||||
let res = r.recv().await;
|
||||
let mut conn = conFact.connection()?;
|
||||
let mut conn = conn_fact.connection()?;
|
||||
match res {
|
||||
Ok(event) => process_event(&mut conn, event)?,
|
||||
Err(e) => {
|
||||
|
||||
Reference in new issue
Block a user