50 lines
1.2 KiB
Rust
50 lines
1.2 KiB
Rust
// Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
use actix_auth_middleware::*;
|
|
use actix_web::web::ServiceConfig;
|
|
|
|
pub mod account;
|
|
pub mod auth;
|
|
pub mod campaigns;
|
|
#[cfg(test)]
|
|
mod tests;
|
|
|
|
pub use super::{get_random, get_uuid, RedirectQuery};
|
|
|
|
pub fn services(cfg: &mut ServiceConfig) {
|
|
auth::services(cfg);
|
|
account::services(cfg);
|
|
campaigns::services(cfg);
|
|
}
|
|
|
|
pub fn get_admin_check_login() -> Authentication<auth::routes::Auth> {
|
|
Authentication::with_identity(super::ROUTES.admin.auth)
|
|
}
|
|
|
|
pub mod routes {
|
|
use super::account::routes::Account;
|
|
use super::auth::routes::Auth;
|
|
use super::campaigns::routes::Campaign;
|
|
use serde::Serialize;
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
|
|
pub struct Admin {
|
|
pub auth: Auth,
|
|
pub account: Account,
|
|
pub campaign: Campaign,
|
|
}
|
|
|
|
impl Admin {
|
|
pub const fn new() -> Admin {
|
|
Admin {
|
|
account: Account::new(),
|
|
auth: Auth::new(),
|
|
campaign: Campaign::new(),
|
|
}
|
|
}
|
|
}
|
|
}
|