Remove broken pieces from api crate

This commit is contained in:
Lennart
2023-09-07 18:50:03 +02:00
parent 092f418ba8
commit dcd6c01b12
2 changed files with 57 additions and 11 deletions

View File

@@ -7,12 +7,10 @@ use rustical_store::calendar::CalendarStore;
use tokio::sync::RwLock;
pub fn configure_api<C: CalendarStore>(cfg: &mut web::ServiceConfig, store: Data<RwLock<C>>) {
cfg.app_data(store)
.route("ping", web::method(Method::GET).to(get_ping::<C>))
.route(
"/{cid}/events",
web::method(Method::GET).to(get_events::<C>),
);
cfg.app_data(store).route(
"/{cid}/events",
web::method(Method::GET).to(get_events::<C>),
);
}
pub async fn get_events<C: CalendarStore>(
@@ -23,8 +21,3 @@ pub async fn get_events<C: CalendarStore>(
let events = store.read().await.get_events(&cid).await.unwrap();
serde_json::to_string_pretty(&events)
}
pub async fn get_ping<C: CalendarStore>(store: Data<RwLock<C>>) -> impl Responder {
let cals = store.read().await.get_calendars().await.unwrap();
serde_json::to_string_pretty(&cals)
}