From 84eb506245a52c8f03d702e2029615ed8a5681e1 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 9 Apr 2021 14:43:25 +0300 Subject: Cleared unused code from handlers The original repo is here: https://github.com/blurbyte/restful-rust --- src/handlers.rs | 80 --------------------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'src/handlers.rs') diff --git a/src/handlers.rs b/src/handlers.rs index ecf5a92..856970d 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -88,83 +88,3 @@ pub async fn propose_block(new_block: Block, db: Db) -> Result Result { -// debug!("list all games"); - -// let games = db.lock().await; -// let games: Vec = games -// .clone() -// .into_iter() -// .skip(options.offset.unwrap_or(0)) -// .take(options.limit.unwrap_or(std::usize::MAX)) -// .collect(); - -// Ok(warp::reply::json(&games)) -// } - -// `POST /games` -// Create new game entry with JSON body -// pub async fn create_game(new_game: Game, db: Db) -> Result { -// debug!("create new game: {:?}", new_game); - -// let mut games = db.lock().await; - -// match games.iter().find(|game| game.id == new_game.id) { -// Some(game) => { -// debug!("game of given id already exists: {}", game.id); - -// Ok(StatusCode::BAD_REQUEST) -// } -// None => { -// games.push(new_game); -// Ok(StatusCode::CREATED) -// } -// } -// } - -// `PUT /games/:id` -// pub async fn update_game(id: u64, updated_game: Game, db: Db) -> Result { -// debug!("update existing game: id={}, game={:?}", id, updated_game); - -// let mut games = db.lock().await; - -// match games.iter_mut().find(|game| game.id == id) { -// Some(game) => { -// *game = updated_game; - -// Ok(StatusCode::OK) -// } -// None => { -// debug!("game of given id not found"); - -// Ok(StatusCode::NOT_FOUND) -// } -// } -// } - -// `DELETE /games/:id` -// pub async fn delete_game(id: u64, db: Db) -> Result { -// debug!("delete game: id={}", id); - -// let mut games = db.lock().await; - -// let len = games.len(); - -// // Removes all games with given id -// games.retain(|game| game.id != id); - -// // If games length was smaller that means specyfic game was found and removed -// let deleted = games.len() != len; - -// if deleted { -// Ok(StatusCode::NO_CONTENT) -// } else { -// debug!("game of given id not found"); - -// Ok(StatusCode::NOT_FOUND) -// } -// } -- cgit v1.2.3-70-g09d2