mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
refactor: replace native_db with memdb and add tests
This commit is contained in:
@@ -23,11 +23,11 @@ use crate::{
|
||||
};
|
||||
|
||||
pub async fn delete_mailbox_impl(account_id: u64, mailbox_id: u64) -> BichonResult<()> {
|
||||
let mailbox = MailBox::async_get(mailbox_id).await?;
|
||||
let mailbox = MailBox::get(mailbox_id)?;
|
||||
|
||||
let name = mailbox.name;
|
||||
let delimiter = mailbox.delimiter.unwrap_or("/".to_owned());
|
||||
let all_mailboxes = MailBox::list_all(account_id).await?;
|
||||
let all_mailboxes = MailBox::list_all(account_id)?;
|
||||
|
||||
let prefix = format!("{}{}", name, delimiter);
|
||||
let ids_to_delete: Vec<u64> = all_mailboxes
|
||||
@@ -41,7 +41,7 @@ pub async fn delete_mailbox_impl(account_id: u64, mailbox_id: u64) -> BichonResu
|
||||
}
|
||||
|
||||
for id in &ids_to_delete {
|
||||
MailBox::delete(*id).await?;
|
||||
MailBox::delete(*id)?;
|
||||
}
|
||||
|
||||
ENVELOPE_MANAGER
|
||||
|
||||
@@ -22,13 +22,13 @@ use crate::error::code::ErrorCode;
|
||||
use crate::error::BichonResult;
|
||||
use crate::imap::executor::ImapExecutor;
|
||||
use crate::imap::session::SessionStream;
|
||||
use crate::utils::create_hash;
|
||||
use crate::raise_error;
|
||||
use crate::utils::create_hash;
|
||||
use async_imap::types::Name;
|
||||
use async_imap::Session;
|
||||
|
||||
pub async fn get_account_mailboxes(account_id: u64, remote: bool) -> BichonResult<Vec<MailBox>> {
|
||||
let account = AccountModel::check_account_exists(account_id).await?;
|
||||
let account = AccountModel::check_account_exists(account_id)?;
|
||||
if remote {
|
||||
if matches!(account.account_type, AccountType::IMAP) {
|
||||
request_imap_all_mailbox_list(account_id).await
|
||||
@@ -39,7 +39,7 @@ pub async fn get_account_mailboxes(account_id: u64, remote: bool) -> BichonResul
|
||||
));
|
||||
}
|
||||
} else {
|
||||
MailBox::list_all(account_id).await
|
||||
MailBox::list_all(account_id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user