1#[macro_use]
3extern crate rust_i18n;
4
5i18n!("locales", fallback = "en");
6
7pub mod auth_keys;
8pub mod config;
9pub mod files;
10pub mod handler;
11pub mod jwt_auth;
12pub mod model;
13pub mod pages;
14pub mod redirect_middleware;
15pub mod response;
16pub mod route;
17pub mod token;
18
19pub use config::Config;
20pub use model::{LoginUserSchema, RegisterUserSchema, User};
21pub use token::{TokenClaims, TokenDetails};
22
23use redis::Client;
24use std::sync::Arc;
25use tokio::sync::Mutex;
26
27pub struct AppState {
28 pub conf: Config,
29 pub redis_client: Client,
30 pub frac: i64,
31 pub user: Mutex<Option<User>>,
32}
33
34impl AppState {
35 #[must_use]
36 pub fn new(conf: Config, redis_client: Client) -> Arc<Self> {
37 Arc::new(Self {
38 conf,
39 redis_client,
40 frac: 0,
41 user: Mutex::new(None),
42 })
43 }
44}