mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 11:00:56 +00:00
refactor: remove unused argument in submit fn
This commit is contained in:
parent
603e5cc698
commit
3e2481e336
2 changed files with 7 additions and 7 deletions
|
|
@ -232,7 +232,7 @@ pub async fn submit_portfolio(
|
||||||
let application: entity::application::Model = session.into();
|
let application: entity::application::Model = session.into();
|
||||||
let candidate = ApplicationService::find_related_candidate(&db, &application).await.map_err(to_custom_error)?; // TODO
|
let candidate = ApplicationService::find_related_candidate(&db, &application).await.map_err(to_custom_error)?; // TODO
|
||||||
|
|
||||||
let submit = PortfolioService::submit(&application.public_key, &candidate, &db).await;
|
let submit = PortfolioService::submit(&candidate, &db).await;
|
||||||
|
|
||||||
if submit.is_err() {
|
if submit.is_err() {
|
||||||
let e = submit.err().unwrap();
|
let e = submit.err().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ impl PortfolioService {
|
||||||
|
|
||||||
|
|
||||||
/// Move files from cache to final directory and delete cache afterwards
|
/// Move files from cache to final directory and delete cache afterwards
|
||||||
pub async fn submit(public_key: &String, candidate: &candidate::Model, db: &DbConn) -> Result<(), ServiceError> {
|
pub async fn submit(candidate: &candidate::Model, db: &DbConn) -> Result<(), ServiceError> {
|
||||||
let candidate_id = candidate.id;
|
let candidate_id = candidate.id;
|
||||||
let path = Self::get_file_store_path().join(&candidate_id.to_string()).to_path_buf();
|
let path = Self::get_file_store_path().join(&candidate_id.to_string()).to_path_buf();
|
||||||
let cache_path = path.join("cache");
|
let cache_path = path.join("cache");
|
||||||
|
|
@ -621,7 +621,7 @@ mod tests {
|
||||||
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
|
|
||||||
PortfolioService::submit(&application.public_key, &candidate, &db).await.unwrap();
|
PortfolioService::submit(&candidate, &db).await.unwrap();
|
||||||
|
|
||||||
assert!(tokio::fs::metadata(application_dir.join("PORTFOLIO.age")).await.is_ok());
|
assert!(tokio::fs::metadata(application_dir.join("PORTFOLIO.age")).await.is_ok());
|
||||||
|
|
||||||
|
|
@ -640,7 +640,7 @@ mod tests {
|
||||||
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
|
|
||||||
PortfolioService::submit(&application.public_key, &candidate, &db).await.unwrap();
|
PortfolioService::submit(&candidate, &db).await.unwrap();
|
||||||
|
|
||||||
assert!(tokio::fs::metadata(application_dir.join("PORTFOLIO.age")).await.is_ok());
|
assert!(tokio::fs::metadata(application_dir.join("PORTFOLIO.age")).await.is_ok());
|
||||||
|
|
||||||
|
|
@ -663,7 +663,7 @@ mod tests {
|
||||||
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
|
|
||||||
PortfolioService::submit(&application.public_key, &candidate, &db).await.unwrap();
|
PortfolioService::submit(&candidate, &db).await.unwrap();
|
||||||
|
|
||||||
assert!(PortfolioService::is_portfolio_submitted(candidate.id).await);
|
assert!(PortfolioService::is_portfolio_submitted(candidate.id).await);
|
||||||
|
|
||||||
|
|
@ -675,7 +675,7 @@ mod tests {
|
||||||
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_letter_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
PortfolioService::add_portfolio_zip_to_cache(candidate.id, vec![0]).await.unwrap();
|
||||||
|
|
||||||
PortfolioService::submit(&application.public_key, &candidate, &db).await.unwrap();
|
PortfolioService::submit(&candidate, &db).await.unwrap();
|
||||||
|
|
||||||
tokio::fs::remove_file(application_dir.join("PORTFOLIO.age")).await.unwrap();
|
tokio::fs::remove_file(application_dir.join("PORTFOLIO.age")).await.unwrap();
|
||||||
|
|
||||||
|
|
@ -706,7 +706,7 @@ mod tests {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
PortfolioService::submit(&application.public_key, &candidate, &db)
|
PortfolioService::submit(&candidate, &db)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue