feat: app-wide adapters loading util
This commit is contained in:
parent
a36684d9ae
commit
753863052a
2 changed files with 25 additions and 0 deletions
24
src/utils/load_adapters.rs
Normal file
24
src/utils/load_adapters.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use actix_web::web::{self, Data};
|
||||||
|
use sqlx::postgres::PgPool;
|
||||||
|
|
||||||
|
use crate::settings::Settings;
|
||||||
|
|
||||||
|
pub fn load_adapters(pool: PgPool, settings: Settings) -> impl FnOnce(&mut web::ServiceConfig) {
|
||||||
|
let f = move |cfg: &mut web::ServiceConfig| {
|
||||||
|
cfg.configure(crate::identity::adapters::load_adapters(
|
||||||
|
pool.clone(),
|
||||||
|
settings.clone(),
|
||||||
|
))
|
||||||
|
.configure(crate::billing::adapters::load_adapters(
|
||||||
|
pool.clone(),
|
||||||
|
settings.clone(),
|
||||||
|
))
|
||||||
|
.configure(super::random_string::GenerateRandomString::inject())
|
||||||
|
.configure(super::uuid::GenerateUUID::inject());
|
||||||
|
};
|
||||||
|
|
||||||
|
Box::new(f)
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
pub mod load_adapters;
|
||||||
pub mod parse_aggregate_id;
|
pub mod parse_aggregate_id;
|
||||||
pub mod random_number;
|
pub mod random_number;
|
||||||
pub mod random_string;
|
pub mod random_string;
|
||||||
|
|
Loading…
Add table
Reference in a new issue