31 lines
740 B
Rust
31 lines
740 B
Rust
use rusqlite::Connection;
|
|
use crate::{CustomResult, Error};
|
|
|
|
pub use crate::services::_users::UserService;
|
|
pub use crate::services::_authentication::SessionService;
|
|
|
|
mod _transactions;
|
|
mod _users;
|
|
mod _authentication;
|
|
mod _securities;
|
|
|
|
pub use crate::db::ledger_internal::LedgerInternal;
|
|
|
|
pub struct ReadOnlyServiceFactory<'a> {
|
|
conn: &'a mut Connection,
|
|
}
|
|
|
|
impl ReadOnlyServiceFactory<'_> {
|
|
pub fn new(conn: &mut Connection) -> ReadOnlyServiceFactory {
|
|
ReadOnlyServiceFactory { conn }
|
|
}
|
|
|
|
pub fn get_user_service(&self) -> UserService {
|
|
UserService::new(self.conn)
|
|
}
|
|
|
|
pub fn get_authentication_service(&mut self) -> CustomResult<SessionService> {
|
|
SessionService::from_conn(self.conn)
|
|
}
|
|
}
|