summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
blob: 166cae4a4f9e14438bba8fc2e02b5bb9b0257faa (plain) (blame)
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
use config::Config;
use db::Database;

mod artist;
mod artwork;
mod comment;
pub mod config;
mod db;
mod error;
mod file;
pub mod routes;
mod ructe_poem;

pub type Result<T> = std::result::Result<T, error::Error>;

#[derive(Clone)]
pub struct Critch {
    db: Database,
    config: Config,
}

impl Critch {
    pub async fn new(config: Config) -> Self {
        let db = Database::new(config.database_connection()).await;

        Self { db, config }
    }
}

include!(concat!(env!("OUT_DIR"), "/templates.rs"));