Added nice security page.
This commit is contained in:
1 parent
18e7b0df1c
commit
509794f02d
12 files changed
+103
-25
No files matched your search
@@ -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})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user