no fucking idea. was on the plane. project runs, tests pass.
This commit is contained in:
1 parent
9cc566c9d5
commit
fed675f4cb
14 files changed
+133
-40
No files matched your search
@@ -0,0 +1,31 @@
|
||||
use crate::util::{CustomResult, Error, SQLiteConnectionFactory};
|
||||
use crate::services::{SessionService, ReadOnlyServiceFactory, UserService};
|
||||
|
||||
struct ServicesCache {
|
||||
session_service: SessionService,
|
||||
}
|
||||
|
||||
struct Services {
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
cache: ServicesCache,
|
||||
}
|
||||
|
||||
impl Services {
|
||||
pub fn new(conn_fact: SQLiteConnectionFactory) -> Services {
|
||||
let mut tmp_conn = conn_fact.connection().unwrap();
|
||||
let session_service = SessionService::from_conn(&mut tmp_conn).unwrap();
|
||||
let cache = ServicesCache{session_service};
|
||||
Services { conn_fact, cache }
|
||||
}
|
||||
|
||||
pub fn get_authentication_service(& self) -> &SessionService {
|
||||
& self.cache.session_service
|
||||
}
|
||||
|
||||
pub fn get_user_service(&self) -> i32 {
|
||||
// let mut conn = self.conn_fact.readonly().unwrap(); // todo; to proper 500
|
||||
// let service_factory = ReadOnlyServiceFactory::new(&mut conn);
|
||||
// service_factory.get_user_service()
|
||||
88
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user