mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-24 17:11:49 +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::{
|
use portfolio_core::{
|
||||||
crypto::random_12_char_string,
|
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 requests::{AdminLoginRequest, RegisterRequest};
|
||||||
use rocket::http::{Cookie, Status, CookieJar};
|
use rocket::http::{Cookie, Status, CookieJar};
|
||||||
|
|
|
||||||
|
|
@ -31,19 +31,6 @@ pub struct CreateCandidateResponse {
|
||||||
pub password: String,
|
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)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CandidateDetails {
|
pub struct CandidateDetails {
|
||||||
|
|
@ -130,38 +117,3 @@ impl NewCandidateResponse {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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