diff options
author | Katharina Fey <kookie@spacekookie.de> | 2018-06-10 20:32:38 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2018-06-10 20:32:38 +0200 |
commit | 28b2a6b9eda45946ffd52020ed4f772ad18b9616 (patch) | |
tree | 2e9e7194d035efe3fc4ee0b6fe1532b1b07f9473 /lockchain-http/src | |
parent | 9a30f0d6036dd8c15cffce11830180fb02529887 (diff) |
Removing User & Login traits from core, adding a metadata store to take their place
Diffstat (limited to 'lockchain-http/src')
-rw-r--r-- | lockchain-http/src/handlers.rs | 2 | ||||
-rw-r--r-- | lockchain-http/src/lib.rs | 9 | ||||
-rw-r--r-- | lockchain-http/src/model.rs | 7 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lockchain-http/src/handlers.rs b/lockchain-http/src/handlers.rs index 64d0b8a..77bc823 100644 --- a/lockchain-http/src/handlers.rs +++ b/lockchain-http/src/handlers.rs @@ -12,6 +12,8 @@ use std::sync::{Arc, Mutex}; type HttpRequestState<T> = HttpRequest<Arc<Mutex<T>>>; /// PUT /vault +/// +/// Check the documentation for more information about how to provide payloads pub fn create_vault<B: Body>(_req: HttpRequestState<impl Vault<B>>) -> impl Responder { format!("Unimplemented!") } diff --git a/lockchain-http/src/lib.rs b/lockchain-http/src/lib.rs index 5192de2..a3872e1 100644 --- a/lockchain-http/src/lib.rs +++ b/lockchain-http/src/lib.rs @@ -10,6 +10,9 @@ //! //! Ideally this shim-layer version should be the same as the `lockchain-core` it binds //! against, however especially during development this won't always be the case. +//! +//! **Note**: API endpoint documentation can be found +//! [here](https://github.com/spacekookie/lockchain/tree/master/lockchain-http#api-reference) #[macro_use] extern crate serde_derive; @@ -23,7 +26,7 @@ mod handlers; mod model; pub use model::CarrierMessage; -use actix_web::{server, App}; +use actix_web::{http, server, App}; use lockchain::traits::{Body, Vault}; use std::sync::{Arc, Mutex}; @@ -58,7 +61,9 @@ pub fn create_server<B: Body + 'static>( server::new(move || { vec![ App::with_state(Arc::clone(&state)) - .resource("/vault", |r| r.f(handlers::create_vault)) + .resource("/vault", |r| { + r.method(http::Method::PUT).with(handlers::create_vault) + }) .resource("/vault/{vaultid}", |r| r.f(handlers::update_vault)) .resource("/vault/{vaultid}", |r| r.f(handlers::delete_vault)) .resource("/vault/{vaultid}/records/{recordid}", |r| { diff --git a/lockchain-http/src/model.rs b/lockchain-http/src/model.rs index c775ee6..f9e2665 100644 --- a/lockchain-http/src/model.rs +++ b/lockchain-http/src/model.rs @@ -14,3 +14,10 @@ pub struct CarrierMessage<T: Serialize + DeserializeOwned> { #[serde(bound(deserialize = "T: Serialize + DeserializeOwned"))] pub data: Option<T>, } + +/// Fields provided when creating a new vault +#[derive(Serialize, Deserialize)] +pub struct VaultCreate { + name: String, + location: String, +} |