Initial commit with Email Import Wizard and Task Processor updates
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import api from './client';
|
||||
|
||||
export interface EmailAttachment {
|
||||
Id: number;
|
||||
FileName: string;
|
||||
ContentType: string;
|
||||
Erechnung: boolean;
|
||||
Checksum?: string;
|
||||
ContentId?: string | null;
|
||||
IsEmbedded?: boolean;
|
||||
ParentId?: number | null;
|
||||
PageCount?: number;
|
||||
PaperlessDocumentIds?: Record<string, number> | null;
|
||||
}
|
||||
|
||||
export interface EmailItem {
|
||||
Id: number;
|
||||
MessageId: string;
|
||||
SenderAddress: string;
|
||||
RecipientAddress: string;
|
||||
Subject: string;
|
||||
Date: string;
|
||||
Body: string;
|
||||
Status: number;
|
||||
Attachments?: EmailAttachment[];
|
||||
}
|
||||
|
||||
export const emailsApi = {
|
||||
list: (params?: { status?: number; limit?: number }) =>
|
||||
api.get<EmailItem[]>('/api/emails', { params }).then((r) => r.data),
|
||||
|
||||
get: (id: number) =>
|
||||
api.get<EmailItem>(`/api/emails/${id}`).then((r) => r.data),
|
||||
|
||||
listAttachments: (emailId: number) =>
|
||||
api.get<EmailAttachment[]>(`/api/emails/${emailId}/attachments`).then((r) => r.data),
|
||||
|
||||
getAttachmentContent: (attachmentId: number) =>
|
||||
api.get<Blob>(`/api/emails/attachments/${attachmentId}/content`, {
|
||||
responseType: 'blob',
|
||||
}).then((r) => r.data),
|
||||
|
||||
triggerFetch: () =>
|
||||
api.post<{ message: string }>('/api/emails/fetch').then((r) => r.data),
|
||||
|
||||
checkAttachments: () =>
|
||||
api.post<{ updatedCount: number }>('/api/emails/check-attachments').then((r) => r.data),
|
||||
|
||||
updateStatus: (id: number, status: number) =>
|
||||
api.patch<{ message?: string }>(`/api/emails/${id}/status`, { status }).then((r) => r.data),
|
||||
};
|
||||
Reference in New Issue
Block a user