style: comments

This commit is contained in:
Sebastian Pravda 2022-12-14 17:23:35 +01:00
parent 24d385bbdf
commit 9fbeb61280
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
5 changed files with 8 additions and 12 deletions

View file

@ -30,11 +30,10 @@ pub struct BaseCandidateResponse {
#[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 {
// pub application_id: i32,
pub name: String, pub name: String,
pub surname: String, pub surname: String,
pub birthplace: String, pub birthplace: String,
pub birthdate: NaiveDate, // TODO: User NaiveDate or String? pub birthdate: NaiveDate,
pub address: String, pub address: String,
pub telephone: String, pub telephone: String,
pub citizenship: String, pub citizenship: String,
@ -46,7 +45,6 @@ pub struct CandidateDetails {
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ParentDetails { pub struct ParentDetails {
// pub application_id: i32,
pub name: String, pub name: String,
pub surname: String, pub surname: String,
pub telephone: String, pub telephone: String,
@ -65,7 +63,7 @@ pub struct ApplicationDetails {
/// CSV export (admin endpoint) /// CSV export (admin endpoint)
#[derive(FromQueryResult, Serialize, Default)] #[derive(FromQueryResult, Serialize, Default)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CandidateWithParent { // TODO: use this instead of (Candidate, Parent)??? pub struct CandidateWithParent {
pub application: i32, pub application: i32,
pub name: Option<String>, pub name: Option<String>,
pub surname: Option<String>, pub surname: Option<String>,

View file

@ -148,7 +148,7 @@ impl EncryptedCandidateDetails {
name: d.0, name: d.0,
surname: d.1, surname: d.1,
birthplace: d.2, 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, address: d.4,
telephone: d.5, telephone: d.5,
citizenship: d.6, citizenship: d.6,
@ -273,7 +273,6 @@ impl EncryptedApplicationDetails {
} }
} }
// TODO: use different metehod for this
impl TryFrom<(candidate::Model, Vec<parent::Model>)> for EncryptedApplicationDetails { impl TryFrom<(candidate::Model, Vec<parent::Model>)> for EncryptedApplicationDetails {
type Error = ServiceError; type Error = ServiceError;
@ -322,7 +321,6 @@ impl TryFrom<CandidateWithParent> for EncryptedApplicationDetails {
} }
} }
// TODO: use this more???
pub async fn decrypt_if_exists( pub async fn decrypt_if_exists(
private_key: &String, private_key: &String,
encrypted_string: Option<String>, encrypted_string: Option<String>,

View file

@ -26,7 +26,7 @@ impl ApplicationService {
db: &DbConn, db: &DbConn,
candidate: candidate::Model, candidate: candidate::Model,
form: &ApplicationDetails, form: &ApplicationDetails,
) -> Result<(candidate::Model, Vec<parent::Model>), ServiceError> { // TODO: is this service needed? ) -> Result<(candidate::Model, Vec<parent::Model>), ServiceError> {
let recipients = get_recipients(db, &candidate.public_key).await?; let recipients = get_recipients(db, &candidate.public_key).await?;
Ok( Ok(

View file

@ -10,7 +10,7 @@ use crate::{
use super::{session_service::{AdminUser, SessionService}, application_service::ApplicationService, portfolio_service::PortfolioService}; use super::{session_service::{AdminUser, SessionService}, application_service::ApplicationService, portfolio_service::PortfolioService};
// TODO // TODO validation
/* pub struct FieldOfStudy { /* pub struct FieldOfStudy {
pub short_name: String, pub short_name: String,
@ -102,7 +102,7 @@ impl CandidateService {
) -> Result<CreateCandidateResponse, ServiceError> { ) -> Result<CreateCandidateResponse, ServiceError> {
let candidate = Query::find_candidate_by_id(db, id).await? let candidate = Query::find_candidate_by_id(db, id).await?
.ok_or(ServiceError::CandidateNotFound)?; .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(); let new_password_plain = crypto::random_8_char_string();
@ -242,7 +242,7 @@ impl CandidateService {
fn is_application_id_valid(application_id: i32) -> bool { fn is_application_id_valid(application_id: i32) -> bool {
let s = &application_id.to_string(); let s = &application_id.to_string();
if s.len() <= 3 { 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; return false;
} }
let field_of_study_prefix = &s[0..3]; let field_of_study_prefix = &s[0..3];

View file

@ -109,7 +109,7 @@ impl SessionService {
// delete old sessions // delete old sessions
SessionService::delete_old_sessions(db, user_id, admin_id, 3) SessionService::delete_old_sessions(db, user_id, admin_id, 3)
.await .await
.ok(); // TODO move to dotenv .ok();
Ok(session.id.to_string()) Ok(session.id.to_string())
} }