feat: add attachment search view

This commit is contained in:
rustmailer
2026-04-19 01:01:46 +08:00
parent 19b5168960
commit 7dd722f9b8
96 changed files with 36331 additions and 28970 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ use crate::{
cache::imap::mailbox::MailBox,
database::{list_all_impl, secondary_find_impl, with_transaction},
error::BichonResult,
store::tantivy::manager::INDEX_MANAGER,
store::tantivy::envelope::ENVELOPE_MANAGER,
users::{role::DEFAULT_ACCOUNT_MANAGER_ROLE_ID, UserModel, DEFAULT_ADMIN_USER_ID},
},
utc_now,
@@ -372,7 +372,7 @@ impl AccountV4 {
OAuth2AccessToken::try_delete(account.id).await?;
UserModel::cleanup_account(account.id).await?;
MailBox::clean(account.id).await?;
INDEX_MANAGER.delete_account_envelopes(account.id).await?;
ENVELOPE_MANAGER.delete_account_envelopes(account.id).await?;
Self::delete_account(account.id).await?;
info!("Sequential cleanup completed for account: {}", account.id);
Ok(())
+19 -2
View File
@@ -96,10 +96,27 @@ pub struct AccountError {
}
impl DownloadState {
pub async fn init(account_id: u64) -> BichonResult<()> {
let state = DownloadState {
pub fn empty(account_id: u64) -> Self {
DownloadState {
account_id,
..Default::default()
}
}
pub async fn init(account_id: u64) -> BichonResult<()> {
let now = utc_now!();
let state = DownloadState {
account_id,
last_trigger_at: now,
active_session: Some(DownloadSession {
start_time: now,
status: DownloadStatus::Running,
trigger: TriggerType::Scheduled,
..Default::default()
}),
history: Default::default(),
last_finished_at: Default::default(),
global_errors: Default::default(),
};
upsert_impl(DB_MANAGER.envelope_db(), state).await
}