feat: check if portfolio is complete

This commit is contained in:
EETagent 2022-11-10 23:22:03 +01:00
parent 4a8c520cae
commit 91125ce7f1

View file

@ -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,