refactor(core/database): AbstractAttachment -> AbstractAttachments

This commit is contained in:
Paul Makles
2023-04-26 16:51:52 +01:00
parent 60ebdb64d7
commit e33ae17061
4 changed files with 6 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ mod mongodb;
mod reference; mod reference;
#[async_trait] #[async_trait]
pub trait AbstractAttachment: Sync + Send { pub trait AbstractAttachments: Sync + Send {
/// Insert attachment into database. /// Insert attachment into database.
async fn insert_attachment(&self, attachment: &File) -> Result<()>; async fn insert_attachment(&self, attachment: &File) -> Result<()>;

View File

@@ -4,12 +4,12 @@ use revolt_result::Result;
use crate::File; use crate::File;
use crate::MongoDb; use crate::MongoDb;
use super::AbstractAttachment; use super::AbstractAttachments;
static COL: &str = "bots"; static COL: &str = "bots";
#[async_trait] #[async_trait]
impl AbstractAttachment for MongoDb { impl AbstractAttachments for MongoDb {
/// Insert attachment into database. /// Insert attachment into database.
async fn insert_attachment(&self, attachment: &File) -> Result<()> { async fn insert_attachment(&self, attachment: &File) -> Result<()> {
query!(self, insert_one, COL, &attachment).map(|_| ()) query!(self, insert_one, COL, &attachment).map(|_| ())

View File

@@ -3,10 +3,10 @@ use revolt_result::Result;
use crate::File; use crate::File;
use crate::ReferenceDb; use crate::ReferenceDb;
use super::AbstractAttachment; use super::AbstractAttachments;
#[async_trait] #[async_trait]
impl AbstractAttachment for ReferenceDb { impl AbstractAttachments for ReferenceDb {
/// Insert attachment into database. /// Insert attachment into database.
async fn insert_attachment(&self, attachment: &File) -> Result<()> { async fn insert_attachment(&self, attachment: &File) -> Result<()> {
let mut attachments = self.files.lock().await; let mut attachments = self.files.lock().await;

View File

@@ -15,7 +15,7 @@ pub trait AbstractDatabase:
+ Send + Send
+ admin_migrations::AbstractMigrations + admin_migrations::AbstractMigrations
+ bots::AbstractBots + bots::AbstractBots
+ files::AbstractAttachment + files::AbstractAttachments
+ users::AbstractUsers + users::AbstractUsers
{ {
} }