From b02e191de8ee9e7c4fe4eb2056b939febbb75129 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 4 Dec 2022 21:12:13 +0100 Subject: [PATCH] refactor: delete deprecated endpoints --- api/src/lib.rs | 2 -- api/src/routes/candidate.rs | 65 ------------------------------------- 2 files changed, 67 deletions(-) diff --git a/api/src/lib.rs b/api/src/lib.rs index 36a0ff3..860a118 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -90,8 +90,6 @@ pub fn rocket() -> Rocket{ "/candidate/portfolio", routes![ routes::candidate::submit_portfolio, - routes::candidate::is_portfolio_prepared, - routes::candidate::is_portfolio_submitted, routes::candidate::submission_progress, routes::candidate::download_portfolio, routes::candidate::delete_portfolio, diff --git a/api/src/routes/candidate.rs b/api/src/routes/candidate.rs index 62da203..fa04a09 100644 --- a/api/src/routes/candidate.rs +++ b/api/src/routes/candidate.rs @@ -131,15 +131,6 @@ pub async fn submission_progress( progress } -// TODO: JSON -#[get["/is_cover_letter"]] -pub async fn is_cover_letter(session: CandidateAuth) -> Result> { - let candidate: entity::candidate::Model = session.into(); - - let exists = PortfolioService::is_cover_letter(candidate.application).await; - - Ok(exists.to_string()) -} #[post("/portfolio_letter", data = "")] pub async fn upload_portfolio_letter( @@ -155,16 +146,6 @@ pub async fn upload_portfolio_letter( Ok(()) } -// TODO: JSON -#[get["/is_portfolio_letter"]] -pub async fn is_portfolio_letter(session: CandidateAuth) -> Result> { - let candidate: entity::candidate::Model = session.into(); - - let exists = PortfolioService::is_portfolio_letter(candidate.application).await; - - Ok(exists.to_string()) -} - #[post("/portfolio_zip", data = "")] pub async fn upload_portfolio_zip( session: CandidateAuth, @@ -179,16 +160,6 @@ pub async fn upload_portfolio_zip( Ok(()) } -// TODO: JSON -#[get["/is_portfolio_zip"]] -pub async fn is_portfolio_zip(session: CandidateAuth) -> Result> { - let candidate: entity::candidate::Model = session.into(); - - let exists = PortfolioService::is_portfolio_zip(candidate.application).await; - - Ok(exists.to_string()) -} - #[post("/submit")] pub async fn submit_portfolio( conn: Connection<'_, Db>, @@ -228,42 +199,6 @@ pub async fn delete_portfolio( Ok(()) } -#[deprecated = "Use /submission_progress instead"] -#[get("/is_prepared")] -pub async fn is_portfolio_prepared(session: CandidateAuth) -> Result> { - let candidate: entity::candidate::Model = session.into(); - - let is_ok = PortfolioService::is_portfolio_prepared(candidate.application).await; - - if !is_ok { - // TODO: Correct error - return Err(Custom( - Status::from_code(404).unwrap_or_default(), - "Portfolio not prepared".to_string(), - )); - } - - Ok("Portfolio ok".to_string()) -} - -#[deprecated = "Use /submission_progress instead"] -#[get("/is_submitted")] -pub async fn is_portfolio_submitted(session: CandidateAuth) -> Result> { - let candidate: entity::candidate::Model = session.into(); - - let is_ok = PortfolioService::is_portfolio_submitted(candidate.application).await; - - if !is_ok { - // TODO: Correct error - return Err(Custom( - Status::from_code(404).unwrap_or_default(), - "Portfolio not submitted".to_string(), - )); - } - - Ok("Portfolio ok".to_string()) -} - #[get("/download")] pub async fn download_portfolio(session: CandidateAuth) -> Result, Custom> { let private_key = session.get_private_key();