Added nice security page.

This commit is contained in:
didier amyot committed 2023-04-11 09:05:31 -04:00
1 parent 18e7b0df1c
commit 509794f02d
12 files changed
+103 -25

No files matched your search

+11 -3
View File
@@ -11,6 +11,11 @@ use crate::services::_securities::SecurityDTO;
pub struct AccountService<'a> {
conn: &'a Connection,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct AccountNumbers {
checking: i64,
security_emitter: i64,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct AccountDTO {
@@ -42,8 +47,6 @@ impl AccountDTO {
}
impl AccountService<'_> {
pub fn new(conn: & Connection) -> AccountService{
@@ -80,7 +83,12 @@ impl AccountService<'_> {
amounts: ac.amount().clone(),
timestamps: ac.timestamps().clone(),
};
Ok(ret)
}
pub fn get_number_of_accounts(&self, sec_id: &SecurityId) -> CustomResult<AccountNumbers>{
let checking = accounts::get_number_of_accounts(self.conn, sec_id, AccountType::Checking)?;
let security_emitter = accounts::get_number_of_accounts(self.conn, sec_id, AccountType::SecurityEmitter)?;
Ok(AccountNumbers{checking, security_emitter})
}
}