Improve routing

This commit is contained in:
Lennart
2025-06-09 16:30:14 +02:00
parent 764d049d3c
commit 8f29a468db
9 changed files with 99 additions and 71 deletions

View File

@@ -1,9 +1,10 @@
use super::methods::mkcol::route_mkcol;
use super::methods::report::route_report_addressbook;
use super::prop::{SupportedAddressData, SupportedReportSet};
use crate::address_object::resource::AddressObjectResource;
use crate::address_object::resource::{AddressObjectResource, AddressObjectResourceService};
use crate::{CardDavPrincipalUri, Error};
use async_trait::async_trait;
use axum::Router;
use axum::extract::Request;
use axum::handler::Handler;
use axum::response::Response;
@@ -266,6 +267,15 @@ impl<AS: AddressbookStore, S: SubscriptionStore> ResourceService
.await?;
Ok(())
}
fn axum_router<State: Send + Sync + Clone + 'static>(self) -> Router<State> {
Router::new()
.nest(
"/{object_id}",
AddressObjectResourceService::new(self.addr_store.clone()).axum_router(),
)
.route_service("/", self.axum_service())
}
}
impl<AS: AddressbookStore, S: SubscriptionStore> AxumMethods for AddressbookResourceService<AS, S> {