feat: mail phase 2 - delete, move, drafts

- Add deleted_at field to Mail/MailAccount/MailFolder models
- Add DELETE /{mail_id} endpoint (soft-delete + IMAP EXPUNGE)
- Add POST /{mail_id}/move endpoint (IMAP UID MOVE + folder_id update)
- Add POST /drafts and PUT /drafts/{id} endpoints (save/edit drafts)
- Add imap_delete_mail() and imap_move_mail() service functions
- Add save_draft() and update_draft() service functions
- Frontend: deleteMail, moveMail, saveDraft, updateDraft API functions
- ComposeModal: draft mode with Save Draft button
- MailDetail: delete/move buttons, edit-draft for drafts
- Mail.tsx: bulk delete/move, move dropdown, draft handlers
- i18n: 13 new keys (de/en)
This commit is contained in:
Agent Zero
2026-07-15 19:44:41 +02:00
parent df83cee10c
commit ed1eec87dc
10 changed files with 950 additions and 21 deletions
+29
View File
@@ -61,6 +61,7 @@ export interface Mail {
date: string;
is_seen: boolean;
is_flagged: boolean;
is_draft: boolean;
is_answered: boolean;
has_attachments: boolean;
attachments?: MailAttachment[];
@@ -573,3 +574,31 @@ export function fetchLabels(): Promise<MailLabel[]> {
export function deleteLabel(labelId: string): Promise<void> {
return apiDelete<void>(`/mail/labels/${labelId}`);
}
// ─── Delete / Move / Drafts ──────────────────────────────────────────────────
export function deleteMail(mailId: string): Promise<void> {
return apiDelete<void>(`/mail/${mailId}`);
}
export function moveMail(mailId: string, targetFolderId: string): Promise<Mail> {
return apiPost<Mail>(`/mail/${mailId}/move`, { target_folder_id: targetFolderId });
}
export interface MailDraftPayload {
account_id: string;
to: string[];
cc: string[];
bcc: string[];
subject: string;
body_text: string;
body_html: string;
}
export function saveDraft(payload: MailDraftPayload): Promise<Mail> {
return apiPost<Mail>('/mail/drafts', payload);
}
export function updateDraft(mailId: string, payload: MailDraftPayload): Promise<Mail> {
return apiPatch<Mail>(`/mail/drafts/${mailId}`, payload);
}