1
// Test-only file to reexport the modules for testing
2
#[macro_use]
3
extern crate rust_i18n;
4

            
5
i18n!("locales", fallback = "en");
6

            
7
pub mod auth_keys;
8
pub mod config;
9
pub mod files;
10
pub mod handler;
11
pub mod jwt_auth;
12
pub mod model;
13
pub mod pages;
14
pub mod redirect_middleware;
15
pub mod response;
16
pub mod route;
17
pub mod token;
18

            
19
pub use config::Config;
20
pub use model::{LoginUserSchema, RegisterUserSchema, User};
21
pub use token::{TokenClaims, TokenDetails};
22

            
23
use redis::Client;
24
use std::sync::Arc;
25
use tokio::sync::Mutex;
26

            
27
pub struct AppState {
28
    pub conf: Config,
29
    pub redis_client: Client,
30
    pub frac: i64,
31
    pub user: Mutex<Option<User>>,
32
}
33

            
34
impl AppState {
35
    #[must_use]
36
92
    pub fn new(conf: Config, redis_client: Client) -> Arc<Self> {
37
92
        Arc::new(Self {
38
92
            conf,
39
92
            redis_client,
40
92
            frac: 0,
41
92
            user: Mutex::new(None),
42
92
        })
43
92
    }
44
}