rb/routing/api/
mod.rs

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
pub mod chats;
pub mod circles;
pub mod comments;
pub mod messages;
pub mod profiles;
pub mod questions;
pub mod reactions;
pub mod responses;
pub mod util;

use crate::database::Database;
use axum::Router;
use hcaptcha_no_wasm::Hcaptcha;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Hcaptcha)]
pub struct CreateReport {
    content: String,
    #[captcha]
    token: String,
}

pub fn routes(database: Database) -> Router {
    Router::new()
        .nest("/util", util::routes(database.clone()))
        .nest("/questions", questions::routes(database.clone()))
        .nest("/responses", responses::routes(database.clone()))
        .nest("/comments", comments::routes(database.clone()))
        .nest("/reactions", reactions::routes(database.clone()))
        .nest("/circles", circles::routes(database.clone()))
        .nest("/profiles", profiles::routes(database.clone()))
        .nest("/chats", chats::routes(database.clone()))
        .nest("/messages", messages::routes(database.clone()))
}