feat: app-wide adapters loading util

This commit is contained in:
Aravinth Manivannan 2025-01-10 15:49:23 +05:30
parent a36684d9ae
commit 753863052a
Signed by: realaravinth
GPG key ID: F8F50389936984FF
2 changed files with 25 additions and 0 deletions

View 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)
}

View file

@ -2,6 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
pub mod load_adapters;
pub mod parse_aggregate_id;
pub mod random_number;
pub mod random_string;