forked from jmug/stoatchat
refactor(core/database): AbstractAttachment -> AbstractAttachments
This commit is contained in:
@@ -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<()>;
|
||||||
|
|
||||||
|
|||||||
@@ -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(|_| ())
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user