Merge branch 'master' into webhooks

This commit is contained in:
Angelo Kontaxis
2023-02-23 17:26:59 +00:00
committed by GitHub
49 changed files with 558 additions and 539 deletions

View File

@@ -27,6 +27,11 @@ mod users {
pub mod user_settings;
}
mod safety {
pub mod report;
pub mod snapshot;
}
pub use admin::migrations::AbstractMigrations;
pub use media::attachment::AbstractAttachment;
@@ -46,6 +51,9 @@ pub use users::bot::AbstractBot;
pub use users::user::AbstractUser;
pub use users::user_settings::AbstractUserSettings;
pub use safety::report::AbstractReport;
pub use safety::snapshot::AbstractSnapshot;
pub trait AbstractDatabase:
Sync
+ Send
@@ -63,5 +71,7 @@ pub trait AbstractDatabase:
+ AbstractUser
+ AbstractUserSettings
+ AbstractWebhook
+ AbstractReport
+ AbstractSnapshot
{
}

View File

@@ -0,0 +1,8 @@
use crate::models::Report;
use crate::Result;
#[async_trait]
pub trait AbstractReport: Sync + Send {
/// Insert a new report into the database
async fn insert_report(&self, report: &Report) -> Result<()>;
}

View File

@@ -0,0 +1,8 @@
use crate::models::Snapshot;
use crate::Result;
#[async_trait]
pub trait AbstractSnapshot: Sync + Send {
/// Insert a new snapshot into the database
async fn insert_snapshot(&self, snapshot: &Snapshot) -> Result<()>;
}