mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-14 20:11:24 +00:00
refactor: remove unused struct
This commit is contained in:
parent
cae0492b72
commit
1ea7f36972
2 changed files with 2 additions and 50 deletions
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue