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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user