fix: fix tests for temp

This commit is contained in:
2024-12-29 00:43:44 +08:00
parent cd26d5bac4
commit c8007078c0
5 changed files with 77 additions and 72 deletions

View File

@@ -13,8 +13,6 @@
//! ```sh
//! cargo run task seed_data refresh:true
//! ```
use std::collections::BTreeMap;
use loco_rs::{db, prelude::*};
use recorder::{app::App, migrations::Migrator};
@@ -29,14 +27,14 @@ impl Task for SeedData {
}
}
async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true");
if refresh {
db::reset::<Migrator>(&app_context.db).await?;
}
let path = std::path::Path::new("src/fixtures");
db::run_app_seed::<App>(&app_context.db, path).await?;
async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
// let refresh = vars.cli.get("refresh").is_some_and(|refresh| refresh == "true");
//
// if refresh {
// db::reset::<Migrator>(&app_context.db).await?;
// }
// let path = std::path::Path::new("src/fixtures");
// db::run_app_seed::<App>(&app_context.db, path).await?;
Ok(())
}
}