Used r2d2 for db connection pool.
This commit is contained in:
1 parent
5df6d5afd1
commit
18f07ac215
8 files changed
+58
-54
No files matched your search
+7
-9
@@ -6,10 +6,10 @@ use log::info;
|
||||
use minijinja::context;
|
||||
use serde::Deserialize;
|
||||
|
||||
|
||||
use crate::events::Event;
|
||||
use crate::services::ReadOnlyServiceFactory;
|
||||
use crate::util::SQLiteConnectionFactory;
|
||||
|
||||
|
||||
use crate::webui::services::Services;
|
||||
use crate::webui::templates::MiniJinjaRenderer;
|
||||
|
||||
#[actix_web::get("/actions")]
|
||||
@@ -25,11 +25,11 @@ pub async fn accounts(tmpl_env: MiniJinjaRenderer) -> actix_web::Result<impl Res
|
||||
#[actix_web::get("/overview")]
|
||||
pub async fn overview(
|
||||
tmpl_env: MiniJinjaRenderer,
|
||||
conn_factory: web::Data<SQLiteConnectionFactory>,
|
||||
service_factory: web::Data<Services>,
|
||||
) -> actix_web::Result<impl Responder> {
|
||||
let mut conn = conn_factory.readonly().unwrap(); // todo; to proper 500
|
||||
let service_factory = ReadOnlyServiceFactory::new(&mut conn);
|
||||
let user_service = service_factory.get_user_service();
|
||||
let conn = service_factory.get_connection()?;
|
||||
let user_service = service_factory.get_user_service(&conn)?;
|
||||
|
||||
let users = user_service.list_users().unwrap();
|
||||
let ctx = context! {
|
||||
users => users,
|
||||
@@ -39,7 +39,6 @@ pub async fn overview(
|
||||
|
||||
#[actix_web::get("/partials/overview/submit_button")]
|
||||
pub async fn overview_submit_button(
|
||||
_req: HttpRequest,
|
||||
tmpl_env: MiniJinjaRenderer,
|
||||
query: web::Query<HashMap<String, String>>,
|
||||
) -> actix_web::Result<impl Responder> {
|
||||
@@ -51,7 +50,6 @@ pub async fn overview_submit_button(
|
||||
|
||||
#[actix_web::get("/partials/actions/action-form")]
|
||||
pub async fn actions_partials(
|
||||
_req: HttpRequest,
|
||||
tmpl_env: MiniJinjaRenderer,
|
||||
query: web::Query<HashMap<String, String>>,
|
||||
) -> actix_web::Result<impl Responder> {
|
||||
|
||||
Reference in new issue
Block a user