update all dependencies
This commit is contained in:
parent
44fc2d7a7e
commit
949eecffb6
10 changed files with 223 additions and 183 deletions
|
@ -10,17 +10,17 @@ repository = { workspace = true }
|
|||
entity = { path = "../entity" }
|
||||
migration = { path = "../migration" }
|
||||
ciborium = "0.2.2"
|
||||
clap = { version = "4.5.7", features = ["derive"] }
|
||||
clap = { version = "4.5.18", features = ["derive"] }
|
||||
config = { version = "0.14.0", default-features = false, features = [ "toml" ] }
|
||||
futures = "0.3.30"
|
||||
itertools = "0.13.0"
|
||||
reqwest = { version = "0.12.5", features = ["json", "rustls-tls"], default-features = false }
|
||||
reqwest = { version = "0.12.7", features = ["json", "rustls-tls"], default-features = false }
|
||||
rumqttc = "0.24.0"
|
||||
sea-orm = { workspace = true, features = [ "with-time", "sqlx-sqlite", "sqlx-postgres", "sqlx-mysql", "runtime-tokio-rustls", "macros" ] }
|
||||
serde = { workspace = true }
|
||||
serde_json = "1.0.118"
|
||||
thiserror = "1.0.61"
|
||||
serde_json = "1.0.128"
|
||||
thiserror = "1.0.64"
|
||||
time = { workspace = true, features = ["macros", "serde", "formatting", "parsing" ] }
|
||||
tokio = { version = "1.38.0", features = ["full"] }
|
||||
tokio = { version = "1.40.0", features = ["full"] }
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
use entity::alerts;
|
||||
use migration::{Migrator, MigratorTrait};
|
||||
use sea_orm::{ActiveModelTrait, Database, DatabaseConnection, DbErr, EntityTrait, Set};
|
||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait, Set};
|
||||
use thiserror::Error;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::json::alert::Alert;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[error("rdbms error")]
|
||||
pub enum RdbmsError {
|
||||
/// Database Error
|
||||
#[error("db error")]
|
||||
DbError(#[from] sea_orm::DbErr),
|
||||
}
|
||||
|
||||
pub struct Db {
|
||||
connection: DatabaseConnection,
|
||||
}
|
||||
|
||||
impl Db {
|
||||
pub async fn is_alert_updated(&self, alert: &Alert) -> Result<bool, DbErr> {
|
||||
pub async fn is_alert_updated(&self, alert: &Alert) -> Result<bool, RdbmsError> {
|
||||
let db_alert = entity::alerts::Entity::find_by_id(&alert.identifier)
|
||||
.one(&self.connection)
|
||||
.await?;
|
||||
|
@ -21,7 +30,7 @@ impl Db {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn save_alert(&self, alert: &Alert) -> Result<(), DbErr> {
|
||||
pub async fn save_alert(&self, alert: &Alert) -> Result<(), RdbmsError> {
|
||||
let db_alert = entity::alerts::Entity::find_by_id(&alert.identifier)
|
||||
.one(&self.connection)
|
||||
.await?;
|
||||
|
@ -40,11 +49,12 @@ impl Db {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn connect(connection_string: &str) -> Result<Db, DbErr> {
|
||||
pub async fn connect(connection_string: &str) -> Result<Db, RdbmsError> {
|
||||
debug!("connecting to {connection_string}...");
|
||||
|
||||
let connection: DatabaseConnection = Database::connect(connection_string).await?;
|
||||
let connection = migration::sea_orm::Database::connect(connection_string).await?;
|
||||
Migrator::up(&connection, None).await?;
|
||||
|
||||
let connection = sea_orm::Database::connect(connection_string).await?;
|
||||
Ok(Db { connection })
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use sea_orm::DbErr;
|
||||
use crate::datastore::rdbms::RdbmsError;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[error("opds error")]
|
||||
#[error("application error")]
|
||||
pub enum Error {
|
||||
/// Database Error
|
||||
#[error("opds error")]
|
||||
DbError(#[from] DbErr),
|
||||
#[error("database error")]
|
||||
DbError(#[from] RdbmsError),
|
||||
/// Error fetching data from alertswiss
|
||||
#[error("data error")]
|
||||
FetchError(#[from] reqwest::Error),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue