diff --git a/api/src/routes/admin.rs b/api/src/routes/admin.rs index f411ae4..4cbe7aa 100644 --- a/api/src/routes/admin.rs +++ b/api/src/routes/admin.rs @@ -2,7 +2,7 @@ use std::net::{SocketAddr, IpAddr, Ipv4Addr}; use portfolio_core::{ crypto::random_12_char_string, - services::{admin_service::AdminService, candidate_service::CandidateService, application_service::ApplicationService, portfolio_service::PortfolioService}, models::{candidate::{BaseCandidateResponse, CreateCandidateResponse, ApplicationDetails}, auth::AuthenticableTrait, application::ApplicationResponse}, sea_orm::prelude::Uuid, Query, error::ServiceError, utils::csv, + services::{admin_service::AdminService, candidate_service::CandidateService, application_service::ApplicationService, portfolio_service::PortfolioService}, models::{candidate::{CreateCandidateResponse, ApplicationDetails}, auth::AuthenticableTrait, application::ApplicationResponse}, sea_orm::prelude::Uuid, Query, error::ServiceError, utils::csv, }; use requests::{AdminLoginRequest, RegisterRequest}; use rocket::http::{Cookie, Status, CookieJar}; diff --git a/core/src/models/candidate.rs b/core/src/models/candidate.rs index 095c44e..9b36218 100644 --- a/core/src/models/candidate.rs +++ b/core/src/models/candidate.rs @@ -31,19 +31,6 @@ pub struct CreateCandidateResponse { pub password: String, } -/// List candidates (admin endpoint) -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BaseCandidateResponse { - pub application_id: i32, - pub name: String, - pub surname: String, - pub email: String, - pub telephone: String, - pub study: String, - pub progress: SubmissionProgress, -} - #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[serde(rename_all = "camelCase")] pub struct CandidateDetails { @@ -129,39 +116,4 @@ impl NewCandidateResponse { encrypted_by: c.encrypted_by_id, }) } -} - -impl BaseCandidateResponse { - pub async fn from_encrypted( - private_key: &String, - c: CandidateResult, - progress: Option, - ) -> Result { - let name = - EncryptedString::decrypt_option(&EncryptedString::try_from(&c.name).ok(), private_key) - .await?; - let surname = EncryptedString::decrypt_option( - &EncryptedString::try_from(&c.surname).ok(), - private_key, - ) - .await?; - let email = - EncryptedString::decrypt_option(&EncryptedString::try_from(&c.email).ok(), private_key) - .await?; - let telephone = EncryptedString::decrypt_option( - &EncryptedString::try_from(&c.telephone).ok(), - private_key, - ) - .await?; - - Ok(Self { - application_id: c.application, - name: name.unwrap_or_default(), - surname: surname.unwrap_or_default(), - email: email.unwrap_or_default(), - telephone: telephone.unwrap_or_default(), - study: c.study.unwrap_or_default(), - progress: progress.unwrap_or(SubmissionProgress::NoneInCache), - }) - } -} +} \ No newline at end of file