change computer.
This commit is contained in:
1 parent
fe32c526eb
commit
358fb19076
10 files changed
+96
-12
No files matched your search
@@ -0,0 +1,30 @@
|
||||
use regex::Regex;
|
||||
//
|
||||
// fn is_number(value: String) -> bool{
|
||||
// true
|
||||
// }
|
||||
//
|
||||
// fn pretty_number(value: String) -> String {
|
||||
// let re = Regex::new(r"\d+").unwrap();
|
||||
// let cap = re.captures(&value);
|
||||
// if cap.is_none() {
|
||||
// return value;
|
||||
// }
|
||||
// let mut ret = "".to_string();
|
||||
// for (idx, letter) in value.as_bytes().iter().enumerate() {
|
||||
// ret.push(letter);
|
||||
// }
|
||||
// "foo".to_string()
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// #[cfg(test)]
|
||||
// pub mod test_minininja_utils {
|
||||
// use super::*;
|
||||
//
|
||||
// #[test]
|
||||
// fn test_pretty_number() {
|
||||
// assert_eq!(pretty_number("foo".to_string()), "foo");
|
||||
// }
|
||||
// }
|
||||
@@ -27,6 +27,7 @@ mod services;
|
||||
mod templates;
|
||||
mod views;
|
||||
mod worker;
|
||||
mod minininja_utils;
|
||||
|
||||
struct ProductionEventProcessor;
|
||||
|
||||
|
||||
+11
-2
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user