mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 17:12:22 +00:00
remove api crate
This commit is contained in:
26
Cargo.lock
generated
26
Cargo.lock
generated
@@ -1650,6 +1650,18 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rstest_reuse"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "88530b681abe67924d42cca181d070e3ac20e0740569441a9e35a7cedd2b34a4"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"rand",
|
||||||
|
"rustc_version",
|
||||||
|
"syn 2.0.50",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.23"
|
version = "0.1.23"
|
||||||
@@ -1674,7 +1686,6 @@ dependencies = [
|
|||||||
"async-trait",
|
"async-trait",
|
||||||
"clap",
|
"clap",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"rustical_api",
|
|
||||||
"rustical_auth",
|
"rustical_auth",
|
||||||
"rustical_caldav",
|
"rustical_caldav",
|
||||||
"rustical_store",
|
"rustical_store",
|
||||||
@@ -1685,18 +1696,6 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustical_api"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"actix-web",
|
|
||||||
"anyhow",
|
|
||||||
"rustical_store",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_auth"
|
name = "rustical_auth"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -1755,6 +1754,7 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
"regex",
|
"regex",
|
||||||
"rstest",
|
"rstest",
|
||||||
|
"rstest_reuse",
|
||||||
"serde",
|
"serde",
|
||||||
"sha2",
|
"sha2",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
rustical_store = { path = "./crates/store/" }
|
rustical_store = { path = "./crates/store/" }
|
||||||
rustical_auth = { path = "./crates/auth/" }
|
rustical_auth = { path = "./crates/auth/" }
|
||||||
rustical_api = { path = "./crates/api/" }
|
|
||||||
rustical_caldav = { path = "./crates/caldav/" }
|
rustical_caldav = { path = "./crates/caldav/" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tokio = { version = "1.35", features = [
|
tokio = { version = "1.35", features = [
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "rustical_api"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
actix-web = "4.4"
|
|
||||||
anyhow = { version = "1.0", features = ["backtrace"] }
|
|
||||||
rustical_store = { path = "../store/" }
|
|
||||||
serde = "1.0"
|
|
||||||
serde_json = "1.0"
|
|
||||||
tokio = { version = "1.32", features = ["sync"] }
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
use actix_web::{
|
|
||||||
http::Method,
|
|
||||||
web::{self, Data, Path},
|
|
||||||
Responder,
|
|
||||||
};
|
|
||||||
use rustical_store::calendar::CalendarStore;
|
|
||||||
use tokio::sync::RwLock;
|
|
||||||
|
|
||||||
pub fn configure_api<C: CalendarStore + ?Sized>(
|
|
||||||
cfg: &mut web::ServiceConfig,
|
|
||||||
store: Data<RwLock<C>>,
|
|
||||||
) {
|
|
||||||
cfg.app_data(store).route(
|
|
||||||
"/{cid}/events",
|
|
||||||
web::method(Method::GET).to(get_events::<C>),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn get_events<C: CalendarStore + ?Sized>(
|
|
||||||
store: Data<RwLock<C>>,
|
|
||||||
path: Path<String>,
|
|
||||||
) -> impl Responder {
|
|
||||||
let cid = path.into_inner();
|
|
||||||
let events = store.read().await.get_events(&cid).await.unwrap();
|
|
||||||
serde_json::to_string_pretty(&events)
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ use actix_web::body::MessageBody;
|
|||||||
use actix_web::dev::{ServiceFactory, ServiceRequest, ServiceResponse};
|
use actix_web::dev::{ServiceFactory, ServiceRequest, ServiceResponse};
|
||||||
use actix_web::middleware::{Logger, NormalizePath};
|
use actix_web::middleware::{Logger, NormalizePath};
|
||||||
use actix_web::{web, App};
|
use actix_web::{web, App};
|
||||||
use rustical_api::configure_api;
|
|
||||||
use rustical_auth::CheckAuthentication;
|
use rustical_auth::CheckAuthentication;
|
||||||
use rustical_caldav::{configure_dav, configure_well_known};
|
use rustical_caldav::{configure_dav, configure_well_known};
|
||||||
use rustical_store::calendar::CalendarStore;
|
use rustical_store::calendar::CalendarStore;
|
||||||
@@ -32,5 +31,4 @@ pub fn make_app<CS: CalendarStore + ?Sized, A: CheckAuthentication>(
|
|||||||
web::scope("/.well-known")
|
web::scope("/.well-known")
|
||||||
.configure(|cfg| configure_well_known(cfg, "/caldav".to_string())),
|
.configure(|cfg| configure_well_known(cfg, "/caldav".to_string())),
|
||||||
)
|
)
|
||||||
.service(web::scope("/api").configure(|cfg| configure_api(cfg, cal_store.clone().into())))
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user