From 9fbeb61280ab56bd79547e8a3549b32bf62c2586 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Wed, 14 Dec 2022 17:23:35 +0100 Subject: [PATCH] style: comments --- core/src/models/candidate.rs | 6 ++---- core/src/models/candidate_details.rs | 4 +--- core/src/services/application_service.rs | 2 +- core/src/services/candidate_service.rs | 6 +++--- core/src/services/session_service.rs | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/core/src/models/candidate.rs b/core/src/models/candidate.rs index 14c4082..a93e44a 100644 --- a/core/src/models/candidate.rs +++ b/core/src/models/candidate.rs @@ -30,11 +30,10 @@ pub struct BaseCandidateResponse { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[serde(rename_all = "camelCase")] pub struct CandidateDetails { - // pub application_id: i32, pub name: String, pub surname: String, pub birthplace: String, - pub birthdate: NaiveDate, // TODO: User NaiveDate or String? + pub birthdate: NaiveDate, pub address: String, pub telephone: String, pub citizenship: String, @@ -46,7 +45,6 @@ pub struct CandidateDetails { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[serde(rename_all = "camelCase")] pub struct ParentDetails { - // pub application_id: i32, pub name: String, pub surname: String, pub telephone: String, @@ -65,7 +63,7 @@ pub struct ApplicationDetails { /// CSV export (admin endpoint) #[derive(FromQueryResult, Serialize, Default)] #[serde(rename_all = "camelCase")] -pub struct CandidateWithParent { // TODO: use this instead of (Candidate, Parent)??? +pub struct CandidateWithParent { pub application: i32, pub name: Option, pub surname: Option, diff --git a/core/src/models/candidate_details.rs b/core/src/models/candidate_details.rs index d620d43..912e6c9 100644 --- a/core/src/models/candidate_details.rs +++ b/core/src/models/candidate_details.rs @@ -148,7 +148,7 @@ impl EncryptedCandidateDetails { name: d.0, surname: d.1, birthplace: d.2, - birthdate: NaiveDate::parse_from_str(&d.3, NAIVE_DATE_FMT).unwrap(), // TODO + birthdate: NaiveDate::parse_from_str(&d.3, NAIVE_DATE_FMT).unwrap(), address: d.4, telephone: d.5, citizenship: d.6, @@ -273,7 +273,6 @@ impl EncryptedApplicationDetails { } } -// TODO: use different metehod for this impl TryFrom<(candidate::Model, Vec)> for EncryptedApplicationDetails { type Error = ServiceError; @@ -322,7 +321,6 @@ impl TryFrom for EncryptedApplicationDetails { } } -// TODO: use this more??? pub async fn decrypt_if_exists( private_key: &String, encrypted_string: Option, diff --git a/core/src/services/application_service.rs b/core/src/services/application_service.rs index c5a6183..6c225e3 100644 --- a/core/src/services/application_service.rs +++ b/core/src/services/application_service.rs @@ -26,7 +26,7 @@ impl ApplicationService { db: &DbConn, candidate: candidate::Model, form: &ApplicationDetails, - ) -> Result<(candidate::Model, Vec), ServiceError> { // TODO: is this service needed? + ) -> Result<(candidate::Model, Vec), ServiceError> { let recipients = get_recipients(db, &candidate.public_key).await?; Ok( diff --git a/core/src/services/candidate_service.rs b/core/src/services/candidate_service.rs index 4a417d0..a22ea53 100644 --- a/core/src/services/candidate_service.rs +++ b/core/src/services/candidate_service.rs @@ -10,7 +10,7 @@ use crate::{ use super::{session_service::{AdminUser, SessionService}, application_service::ApplicationService, portfolio_service::PortfolioService}; -// TODO +// TODO validation /* pub struct FieldOfStudy { pub short_name: String, @@ -102,7 +102,7 @@ impl CandidateService { ) -> Result { let candidate = Query::find_candidate_by_id(db, id).await? .ok_or(ServiceError::CandidateNotFound)?; - let parents = Query::find_candidate_parents(db, candidate.clone()).await?; // TODO + let parents = Query::find_candidate_parents(db, candidate.clone()).await?; let new_password_plain = crypto::random_8_char_string(); @@ -242,7 +242,7 @@ impl CandidateService { fn is_application_id_valid(application_id: i32) -> bool { let s = &application_id.to_string(); if s.len() <= 3 { - // TODO: does the field of study prefix have to be exactly 6 digits? + // TODO: does the field of study prefix have to be exactly 6 digits? VYRESIT PODLE PRIHLASEK!!! return false; } let field_of_study_prefix = &s[0..3]; diff --git a/core/src/services/session_service.rs b/core/src/services/session_service.rs index 389c712..78bc054 100644 --- a/core/src/services/session_service.rs +++ b/core/src/services/session_service.rs @@ -109,7 +109,7 @@ impl SessionService { // delete old sessions SessionService::delete_old_sessions(db, user_id, admin_id, 3) .await - .ok(); // TODO move to dotenv + .ok(); Ok(session.id.to_string()) }