Irvin Blais rock!
This commit is contained in:
1 parent
f2c6c8d65c
commit
0d0337a6aa
17 files changed
+175
-39
No files matched your search
+19
-3
@@ -24,14 +24,27 @@ pub async fn accounts(tmpl_env: MiniJinjaRenderer,
|
||||
req: HttpRequest,
|
||||
service_factory: web::Data<ServicesFactory>) -> actix_web::Result<impl Responder> {
|
||||
let conn = service_factory.get_connection()?;
|
||||
let auth_service = service_factory.get_authentication_service()?;
|
||||
let auth_service = service_factory.get_authentication_service(&conn)?;
|
||||
let user = auth_service.get_login(&req);
|
||||
let account_service = service_factory.get_account_service(& conn)?;
|
||||
let accounts = account_service.get_user_accounts(user.unwrap())
|
||||
.map_err(actix_web::error::ErrorInternalServerError)?;
|
||||
let accounts = account_service.get_user_accounts(&user.unwrap())
|
||||
.map_err(error::ErrorInternalServerError)?;
|
||||
tmpl_env.render("accounts.html", context!{accounts => accounts})
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[actix_web::get("/securities")]
|
||||
pub async fn securities(tmpl_env: MiniJinjaRenderer,
|
||||
service_factory: web::Data<ServicesFactory>) -> actix_web::Result<impl Responder> {
|
||||
let conn = service_factory.get_connection()?;
|
||||
let account_service = service_factory.get_security_service(& conn)?;
|
||||
let ctx = context!{
|
||||
securities => account_service.list_securities()
|
||||
};
|
||||
tmpl_env.render("securities.html", ctx)
|
||||
}
|
||||
|
||||
#[actix_web::get("/overview")]
|
||||
pub async fn overview(
|
||||
tmpl_env: MiniJinjaRenderer,
|
||||
@@ -60,6 +73,7 @@ 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>>,
|
||||
service_factory: web::Data<ServicesFactory>,
|
||||
@@ -70,9 +84,11 @@ pub async fn actions_partials(
|
||||
.to_string();
|
||||
let conn = service_factory.get_connection()?;
|
||||
let security_service = service_factory.get_security_service(&conn)?;
|
||||
let authentication_service = service_factory.get_authentication_service(&conn)?;
|
||||
let ctx = context! {
|
||||
event_type => event_type,
|
||||
securities => security_service.list_securities(),
|
||||
user => authentication_service.get_logged_in_user(&req).map_err(actix_web::error::ErrorInternalServerError)?,
|
||||
};
|
||||
let template_location = format!("partials/actions/{:}.html", event_type);
|
||||
info!("Getting template at: {:?}", template_location);
|
||||
|
||||
Reference in new issue
Block a user