mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-08 01:00:16 +00:00
refactor: refactor is_portfolio_prepared
This commit is contained in:
parent
530994f33d
commit
e9f3a8042c
1 changed files with 9 additions and 9 deletions
|
|
@ -127,15 +127,15 @@ impl CandidateService {
|
||||||
pub async fn is_portfolio_prepared(candidate_id: i32) -> bool {
|
pub async fn is_portfolio_prepared(candidate_id: i32) -> bool {
|
||||||
let cache_path = Path::new(&candidate_id.to_string()).join("cache");
|
let cache_path = Path::new(&candidate_id.to_string()).join("cache");
|
||||||
|
|
||||||
tokio::fs::metadata(cache_path.join("MOTIVACNI_DOPIS.pdf"))
|
let filenames = vec!["MOTIVACNI_DOPIS.pdf", "PORTFOLIO.pdf", "PORTFOLIO.zip"];
|
||||||
.await
|
|
||||||
.is_ok()
|
for filename in filenames {
|
||||||
&& tokio::fs::metadata(cache_path.join("PORTFOLIO.pdf"))
|
if !tokio::fs::metadata(cache_path.join(filename)).await.is_ok() {
|
||||||
.await
|
return false;
|
||||||
.is_ok()
|
}
|
||||||
&& tokio::fs::metadata(cache_path.join("PORTFOLIO.zip"))
|
}
|
||||||
.await
|
|
||||||
.is_ok()
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete_cache(candidate_id: i32) -> Result<(), ServiceError> {
|
pub async fn delete_cache(candidate_id: i32) -> Result<(), ServiceError> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue