1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::service::hash_service::HashService;
use crate::service::validation_code_service::ValidationCodeService;
use lightspeed_core::error::LightSpeedError;
use lightspeed_core::CoreModule;
use log::*;
use std::sync::Arc;
pub mod dto;
pub mod service;
#[derive(Clone)]
pub struct HashModule {
pub hash_service: Arc<HashService>,
pub validation_code_service: Arc<ValidationCodeService>,
}
impl HashModule {
pub fn new(core_module: &CoreModule) -> Result<Self, LightSpeedError> {
println!("Creating HashModule");
info!("Creating HashModule");
let hash_service = Arc::new(HashService::new());
let validation_code_service =
Arc::new(ValidationCodeService::new(hash_service.clone(), core_module.jwt.clone()));
Ok(HashModule { hash_service, validation_code_service })
}
}
#[async_trait::async_trait]
impl lightspeed_core::module::Module for HashModule {
async fn start(&mut self) -> Result<(), LightSpeedError> {
info!("Starting HashModule");
Ok(())
}
}