mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
Improve routing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::addressbook::resource::AddressbookResource;
|
||||
use crate::addressbook::resource::{AddressbookResource, AddressbookResourceService};
|
||||
use crate::{CardDavPrincipalUri, Error};
|
||||
use async_trait::async_trait;
|
||||
use axum::Router;
|
||||
use rustical_dav::extensions::{CommonPropertiesExtension, CommonPropertiesProp};
|
||||
use rustical_dav::privileges::UserPrivilegeSet;
|
||||
use rustical_dav::resource::{AxumMethods, PrincipalUri, Resource, ResourceService};
|
||||
@@ -174,6 +175,16 @@ impl<A: AddressbookStore, AP: AuthenticationProvider, S: SubscriptionStore> Reso
|
||||
.map(|addressbook| (addressbook.id.to_owned(), addressbook.into()))
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn axum_router<State: Send + Sync + Clone + 'static>(self) -> Router<State> {
|
||||
Router::new()
|
||||
.nest(
|
||||
"/{addressbook_id}",
|
||||
AddressbookResourceService::new(self.addr_store.clone(), self.sub_store.clone())
|
||||
.axum_router(),
|
||||
)
|
||||
.route_service("/", self.axum_service())
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: AddressbookStore, AP: AuthenticationProvider, S: SubscriptionStore> AxumMethods
|
||||
|
||||
Reference in New Issue
Block a user