update name

This commit is contained in:
OMGeeky
2024-04-20 12:48:24 +02:00
parent 7ad57a8bea
commit d9d937ddd0

View File

@@ -1,7 +1,7 @@
use anyhow::Context;
use local_db::entities::status::Status;
use local_db::entities::videos;
use local_db::print_db;
use twba_local_db::entities::status::Status;
use twba_local_db::entities::videos;
use twba_local_db::print_db;
use sea_orm::ActiveValue::Set;
use sea_orm::{ActiveModelTrait, DatabaseConnection, IntoActiveModel};
use std::error::Error;
@@ -18,23 +18,23 @@ async fn run() -> Result<(), Box<dyn Error>> {
tracing_subscriber::fmt()
.pretty()
.with_max_level(tracing::Level::DEBUG)
.with_env_filter("sqlx=warn,sea_orm=warn")
.with_env_filter("sqlx=warn,sea_orm=warn,twba_local_db=trace")
.init();
info!("Hello, world!");
let db = local_db::open_database(None).await?;
local_db::reset_db(&db).await?;
local_db::migrate_db(&db).await?;
local_db::print_db(&db).await?;
let db = twba_local_db::open_database(None).await?;
twba_local_db::reset_db(&db).await?;
twba_local_db::migrate_db(&db).await?;
print_db(&db).await?;
sample(&db).await?;
info!("Bye!");
Ok(())
}
#[instrument]
async fn sample(db: &DatabaseConnection) -> anyhow::Result<()> {
let users = local_db::get_watched_users(db).await?;
let users = twba_local_db::get_watched_users(db).await?;
let user = users.first().context("Could not get any users...")?;
info!("User: {:?}", user);
let not_started_videos = local_db::get_videos_with_status(db, user, Status::NotStarted).await?;
let not_started_videos = twba_local_db::get_videos_with_status(db, user, Status::NotStarted).await?;
info!("Not started videos: {:?}", not_started_videos.len());
let mut not_started_videos: Vec<videos::ActiveModel> = not_started_videos