1use crate::options::MailOptions;
2use crate::MailService;
3use axum::Router;
4use nestrs_core::{DynamicModule, ProviderRegistry};
5use std::any::TypeId;
6use std::sync::Arc;
7
8pub struct MailModule;
9
10impl MailModule {
11 pub fn register(options: MailOptions) -> DynamicModule {
12 let mut registry = ProviderRegistry::new();
13 let service = Arc::new(MailService::from_options(&options));
14 registry.register_use_value::<MailService>(service);
15 DynamicModule::from_parts(registry, Router::new(), vec![TypeId::of::<MailService>()])
16 }
17}