mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
refactor(core/database): AbstractAttachment -> AbstractAttachments
This commit is contained in:
@@ -6,7 +6,7 @@ mod mongodb;
|
||||
mod reference;
|
||||
|
||||
#[async_trait]
|
||||
pub trait AbstractAttachment: Sync + Send {
|
||||
pub trait AbstractAttachments: Sync + Send {
|
||||
/// Insert attachment into database.
|
||||
async fn insert_attachment(&self, attachment: &File) -> Result<()>;
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ use revolt_result::Result;
|
||||
use crate::File;
|
||||
use crate::MongoDb;
|
||||
|
||||
use super::AbstractAttachment;
|
||||
use super::AbstractAttachments;
|
||||
|
||||
static COL: &str = "bots";
|
||||
|
||||
#[async_trait]
|
||||
impl AbstractAttachment for MongoDb {
|
||||
impl AbstractAttachments for MongoDb {
|
||||
/// Insert attachment into database.
|
||||
async fn insert_attachment(&self, attachment: &File) -> Result<()> {
|
||||
query!(self, insert_one, COL, &attachment).map(|_| ())
|
||||
|
||||
@@ -3,10 +3,10 @@ use revolt_result::Result;
|
||||
use crate::File;
|
||||
use crate::ReferenceDb;
|
||||
|
||||
use super::AbstractAttachment;
|
||||
use super::AbstractAttachments;
|
||||
|
||||
#[async_trait]
|
||||
impl AbstractAttachment for ReferenceDb {
|
||||
impl AbstractAttachments for ReferenceDb {
|
||||
/// Insert attachment into database.
|
||||
async fn insert_attachment(&self, attachment: &File) -> Result<()> {
|
||||
let mut attachments = self.files.lock().await;
|
||||
|
||||
@@ -15,7 +15,7 @@ pub trait AbstractDatabase:
|
||||
+ Send
|
||||
+ admin_migrations::AbstractMigrations
|
||||
+ bots::AbstractBots
|
||||
+ files::AbstractAttachment
|
||||
+ files::AbstractAttachments
|
||||
+ users::AbstractUsers
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user