From 91125ce7f1f1fbfe8f0d459bd8c2647dc4c38a2e Mon Sep 17 00:00:00 2001 From: EETagent Date: Thu, 10 Nov 2022 23:22:03 +0100 Subject: [PATCH] feat: check if portfolio is complete --- core/src/services/candidate_service.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/services/candidate_service.rs b/core/src/services/candidate_service.rs index 66df9e3..9d53d16 100644 --- a/core/src/services/candidate_service.rs +++ b/core/src/services/candidate_service.rs @@ -124,6 +124,20 @@ impl CandidateService { Self::write_portfolio_file(candidate_id, zip, "PORTFOLIO.zip").await } + pub async fn is_portfolio_complete(candidate_id: i32) -> bool { + let cache_path = Path::new(&candidate_id.to_string()).join("cache"); + + tokio::fs::metadata(cache_path.join("MOTIVACNI_DOPIS.pdf")) + .await + .is_ok() + && tokio::fs::metadata(cache_path.join("PORTFOLIO.pdf")) + .await + .is_ok() + && tokio::fs::metadata(cache_path.join("PORTFOLIO.zip")) + .await + .is_ok() + } + async fn decrypt_private_key( candidate: candidate::Model, password: String,