refactor: remove unused struct

This commit is contained in:
Sebastian Pravda 2023-01-15 14:52:33 +01:00
parent cae0492b72
commit 1ea7f36972
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
2 changed files with 2 additions and 50 deletions

View file

@ -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};

View file

@ -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<SubmissionProgress>,
) -> Result<Self, ServiceError> {
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),
})
}
}
}