change computer.

This commit is contained in:
didier amyot committed 2023-04-08 17:30:09 -04:00
1 parent fe32c526eb
commit 358fb19076
10 files changed
+96 -12

No files matched your search

+11 -2
View File
@@ -8,7 +8,7 @@ use minijinja::context;
use rusqlite::params;
use serde::Deserialize;
use uuid::Uuid;
use crate::db::external_id::{Id, SecurityId};
use crate::db::external_id::{AccountId, Id, SecurityId};
use crate::events::Event;
@@ -37,8 +37,17 @@ pub async fn accounts(tmpl_env: MiniJinjaRenderer,
pub async fn account(tmpl_env: MiniJinjaRenderer,
req: HttpRequest,
service_factory: web::Data<ServicesFactory>) -> actix_web::Result<impl Responder> {
let path_event_type = req.match_info().get("account_id").unwrap();
let account_id = AccountId::from_string(&path_event_type.to_string()).unwrap();
let conn = service_factory.get_connection()?;
let auth_service = service_factory.get_authentication_service(&conn)?;
let account_service = service_factory.get_account_service(& conn)?;
let user_id = auth_service.get_login(&req).unwrap();
tmpl_env.render("account.html", context!{})
let ctx = context!{
account => account_service.get_account_by_id(&account_id, &user_id).map_err(error::ErrorInternalServerError)?
};
tmpl_env.render("account.html", ctx)
}