diff options
author | Yigit Sever | 2021-04-10 16:56:00 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-10 16:56:00 +0300 |
commit | 001a9ac21c29af53d31e9710d12e37d565880207 (patch) | |
tree | 7e0bbbc0b828694950ffaff6f6b51f63a62f46c7 /src/routes.rs | |
parent | a3bc90d6755acbe3670dfcf23f35acdaf9b00ffc (diff) | |
download | gradecoin-001a9ac21c29af53d31e9710d12e37d565880207.tar.gz gradecoin-001a9ac21c29af53d31e9710d12e37d565880207.tar.bz2 gradecoin-001a9ac21c29af53d31e9710d12e37d565880207.zip |
giving up with style
Diffstat (limited to 'src/routes.rs')
-rw-r--r-- | src/routes.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/routes.rs b/src/routes.rs index 871fd9c..b389919 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -8,7 +8,8 @@ use crate::schema::{Db, Transaction}; | |||
8 | /// Root, all routes combined | 8 | /// Root, all routes combined |
9 | pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { | 9 | pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { |
10 | transaction_list(db.clone()) | 10 | transaction_list(db.clone()) |
11 | .or(transaction_propose(db.clone())) | 11 | // .or(transaction_propose(db.clone())) |
12 | .or(authenticated_transaction_propose(db.clone())) | ||
12 | .or(block_propose(db.clone())) | 13 | .or(block_propose(db.clone())) |
13 | .or(block_list(db.clone())) | 14 | .or(block_list(db.clone())) |
14 | } | 15 | } |
@@ -51,16 +52,16 @@ pub fn authenticated_transaction_propose( | |||
51 | // // header/jwt logic to propose_transaction but that doesn't feel right either | 52 | // // header/jwt logic to propose_transaction but that doesn't feel right either |
52 | // // good luck <10-04-21, yigit> // | 53 | // // good luck <10-04-21, yigit> // |
53 | 54 | ||
55 | let db1 = db.clone(); | ||
54 | warp::path("transaction") | 56 | warp::path("transaction") |
55 | .and(warp::path::end()) | 57 | .and(warp::path::end()) |
56 | .and(warp::post()) | 58 | .and(warp::post()) |
57 | .and(custom_filters::transaction_json_body()) // returns transaction | 59 | .and(custom_filters::transaction_json_body()) // returns transaction |
58 | .map(|t: Transaction| { | 60 | .map(move |t: Transaction| { |
59 | // what do these do? | 61 | with_auth(db1.clone(), t).boxed() |
60 | with_auth(db.clone(), t) | ||
61 | }) | 62 | }) |
62 | .and(custom_filters::transaction_json_body()) // returns transaction | 63 | .and(custom_filters::transaction_json_body()) // returns transaction |
63 | .and(custom_filters::with_db(db)) // wraps db | 64 | .and(custom_filters::with_db(db.clone())) // wraps db |
64 | .and_then(handlers::propose_authenticated_transaction) // uses db, transaction and authenticated | 65 | .and_then(handlers::propose_authenticated_transaction) // uses db, transaction and authenticated |
65 | } | 66 | } |
66 | 67 | ||