refactor: remove loco-rs

This commit is contained in:
2025-02-28 03:19:48 +08:00
parent c0707d17bb
commit a68aab1452
66 changed files with 1321 additions and 829 deletions

View File

@@ -1,3 +1,2 @@
mod models;
mod requests;
mod tasks;

View File

@@ -1,5 +1,4 @@
// use insta::assert_debug_snapshot;
// use loco_rs::testing;
// use recorder::{app::App, models::subscribers::Model};
use serial_test::serial;

View File

@@ -1,7 +1,6 @@
#![allow(unused_imports)]
use insta::{assert_debug_snapshot, with_settings};
use loco_rs::testing;
use recorder::app::App;
use recorder::app::App1;
use serial_test::serial;
macro_rules! configure_insta {
@@ -17,15 +16,4 @@ macro_rules! configure_insta {
#[serial]
async fn can_get_current_user() {
configure_insta!();
// testing::request::<App, _, _>(|request, _ctx| async move {
// let response = request.get("/api/user/current").await;
// with_settings!({
// filters => testing::cleanup_user_model()
// }, {
// assert_debug_snapshot!((response.status_code(),
// response.text())); });
// })
// .await;
}

View File

@@ -1 +0,0 @@
pub mod seed;

View File

@@ -1,42 +0,0 @@
//! This task implements data seeding functionality for initializing new
//! development/demo environments.
//!
//! # Example
//!
//! Run the task with the following command:
//! ```sh
//! cargo run task
//! ```
//!
//! To override existing data and reset the data structure, use the following
//! command with the `refresh:true` argument:
//! ```sh
//! cargo run task seed_data refresh:true
//! ```
#![allow(unused_imports)]
use loco_rs::{db, prelude::*};
use recorder::{app::App, migrations::Migrator};
#[allow(clippy::module_name_repetitions)]
pub struct SeedData;
#[async_trait]
impl Task for SeedData {
fn task(&self) -> TaskInfo {
TaskInfo {
name: "seed_data".to_string(),
detail: "Task for seeding data".to_string(),
}
}
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(())
}
}