summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2021-04-09 14:46:24 +0300
committerYigit Sever2021-04-09 14:46:24 +0300
commit4f02e577984da089ed47973ed01c31c23e74cb71 (patch)
tree605df0426591a993a7c383b0f37cc94abb2dc5e5
parent9cc9d7d41e0697a82b05841062e8c0d001b94ad3 (diff)
downloadgradecoin-4f02e577984da089ed47973ed01c31c23e74cb71.tar.gz
gradecoin-4f02e577984da089ed47973ed01c31c23e74cb71.tar.bz2
gradecoin-4f02e577984da089ed47973ed01c31c23e74cb71.zip
Remove unused code from routes
Original repo here: https://github.com/blurbyte/restful-rust
-rw-r--r--src/routes.rs63
1 files changed, 4 insertions, 59 deletions
diff --git a/src/routes.rs b/src/routes.rs
index 9054fb6..f67c3b0 100644
--- a/src/routes.rs
+++ b/src/routes.rs
@@ -12,7 +12,7 @@ pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rej
12 .or(block_list(db.clone())) 12 .or(block_list(db.clone()))
13} 13}
14 14
15/// GET /transaction 15/// GET /transaction warp route
16pub fn transaction_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { 16pub fn transaction_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
17 warp::path!("transaction") 17 warp::path!("transaction")
18 .and(warp::get()) 18 .and(warp::get())
@@ -20,7 +20,7 @@ pub fn transaction_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rej
20 .and_then(handlers::list_transactions) 20 .and_then(handlers::list_transactions)
21} 21}
22 22
23/// GET /block 23/// GET /block warp route
24pub fn block_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { 24pub fn block_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
25 warp::path!("block") 25 warp::path!("block")
26 .and(warp::get()) 26 .and(warp::get())
@@ -28,7 +28,7 @@ pub fn block_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection
28 .and_then(handlers::list_blocks) 28 .and_then(handlers::list_blocks)
29} 29}
30 30
31/// POST /transaction 31/// POST /transaction warp route
32pub fn transaction_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { 32pub fn transaction_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
33 warp::path!("transaction") 33 warp::path!("transaction")
34 .and(warp::post()) 34 .and(warp::post())
@@ -37,7 +37,7 @@ pub fn transaction_propose(db: Db) -> impl Filter<Extract = impl Reply, Error =
37 .and_then(handlers::propose_transaction) 37 .and_then(handlers::propose_transaction)
38} 38}
39 39
40/// POST /block 40/// POST /block warp route
41pub fn block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { 41pub fn block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
42 warp::path!("block") 42 warp::path!("block")
43 .and(warp::post()) 43 .and(warp::post())
@@ -46,61 +46,6 @@ pub fn block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = Reject
46 .and_then(handlers::propose_block) 46 .and_then(handlers::propose_block)
47} 47}
48 48
49///////////////////////////
50// below are not mine. //
51///////////////////////////
52
53// Root, all routes combined
54//pub fn games_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
55// games_list(db.clone())
56// .or(games_create(db.clone()))
57// .or(games_update(db.clone()))
58// .or(games_delete(db))
59//}
60
61//// `GET /games?offset=3&limit=5`
62//pub fn games_list(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
63// warp::path!("games")
64// .and(warp::get())
65// .and(custom_filters::list_options())
66// .and(custom_filters::with_db(db))
67// .and_then(handlers::list_games)
68//}
69
70//// `POST /games`
71//pub fn games_create(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
72// warp::path!("games")
73// .and(warp::post())
74// .and(custom_filters::json_body())
75// .and(custom_filters::with_db(db))
76// .and_then(handlers::create_game)
77//}
78
79//// `PUT /games/:id`
80//pub fn games_update(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
81// warp::path!("games" / u64)
82// .and(warp::put())
83// .and(custom_filters::json_body())
84// .and(custom_filters::with_db(db))
85// .and_then(handlers::update_game)
86//}
87
88//// `DELETE /games/:id`
89//pub fn games_delete(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
90// warp::path!("games" / u64)
91// .and(warp::delete())
92// .and(custom_filters::with_db(db))
93// .and_then(handlers::delete_game)
94//}
95
96////////////////////////////////
97//// tests below, it's fine //
98////////////////////////////////
99
100/////////////////////////////////////
101// of course I'll write tests... //
102/////////////////////////////////////
103
104// TODO: write tests <07-04-21, yigit> // 49// TODO: write tests <07-04-21, yigit> //
105 50
106//#[cfg(test)] 51//#[cfg(test)]