mcaptcha/api/v1/
routes.rs

1// Copyright (C) 2022  Aravinth Manivannan <realaravinth@batsense.net>
2// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6use actix_auth_middleware::GetLoginRoute;
7
8use super::account::routes::Account;
9use super::auth::routes::Auth;
10use super::mcaptcha::routes::Captcha;
11use super::meta::routes::Meta;
12use super::notifications::routes::Notifications;
13use super::pow::routes::PoW;
14use super::stats::routes::Stats;
15use super::survey::routes::Survey;
16
17pub const ROUTES: Routes = Routes::new();
18
19pub struct Routes {
20    pub auth: Auth,
21    pub account: Account,
22    pub captcha: Captcha,
23    pub meta: Meta,
24    pub pow: PoW,
25    pub survey: Survey,
26    pub notifications: Notifications,
27    pub stats: Stats,
28}
29
30impl Routes {
31    const fn new() -> Routes {
32        Routes {
33            auth: Auth::new(),
34            account: Account::new(),
35            captcha: Captcha::new(),
36            meta: Meta::new(),
37            pow: PoW::new(),
38            notifications: Notifications::new(),
39            survey: Survey::new(),
40            stats: Stats::new(),
41        }
42    }
43}
44
45impl GetLoginRoute for Routes {
46    fn get_login_route(&self, src: Option<&str>) -> String {
47        self.auth.get_login_route(src)
48    }
49}