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 config;
8
pub mod files;
9
pub mod handler;
10
pub mod jwt_auth;
11
pub mod model;
12
pub mod pages;
13
pub mod redirect_middleware;
14
pub mod response;
15
pub mod route;
16
pub mod token;
17

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

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

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

            
33
impl AppState {
34
160
    pub fn new(conf: Config, redis_client: Client) -> Arc<Self> {
35
160
        Arc::new(Self {
36
160
            conf,
37
160
            redis_client,
38
160
            frac: 0,
39
160
            user: Mutex::new(None),
40
160
        })
41
160
    }
42
}