Initial commit with Email Import Wizard and Task Processor updates
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import api from './client';
|
||||
|
||||
export interface CorrespondentMapping {
|
||||
Id: number;
|
||||
EmailAddress: string;
|
||||
PaperlessCorrespondentId: number;
|
||||
}
|
||||
|
||||
export interface AttachmentImportData {
|
||||
attachmentId: number;
|
||||
virtualId: string;
|
||||
fileName: string;
|
||||
pages?: { start: number; end: number };
|
||||
type: 'MAIN' | 'ATTACHMENT' | 'IGNORE';
|
||||
paperlessCorrespondentId?: number | null;
|
||||
parentDocumentId?: number | null;
|
||||
parentVirtualId?: string | null;
|
||||
splitRanges?: { start: number; end: number }[];
|
||||
barcode?: { x: number; y: number; nummer: string; datum: string; jahr: string };
|
||||
belegnummer?: string;
|
||||
isDuplicate?: boolean;
|
||||
}
|
||||
|
||||
export const emailImportApi = {
|
||||
getMappings: async (): Promise<CorrespondentMapping[]> => {
|
||||
const res = await api.get('/api/email-import/mappings');
|
||||
return res.data;
|
||||
},
|
||||
|
||||
addMapping: async (emailAddress: string, paperlessCorrespondentId: number): Promise<CorrespondentMapping> => {
|
||||
const res = await api.post('/api/email-import/mappings', { emailAddress, paperlessCorrespondentId });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
deleteMapping: async (id: number): Promise<void> => {
|
||||
await api.delete(`/api/email-import/mappings/${id}`);
|
||||
},
|
||||
|
||||
getCorrespondentByEmail: async (emailAddress: string): Promise<{ paperlessCorrespondentId: number | null }> => {
|
||||
const res = await api.get('/api/email-import/correspondent', { params: { email: emailAddress } });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
getBelegnummer: async (dateStr: string): Promise<{ nummer: string }> => {
|
||||
const res = await api.get('/api/email-import/belegnummer', { params: { date: dateStr } });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
releaseBelegnummer: async (dateStr: string, number: string): Promise<void> => {
|
||||
await api.post('/api/email-import/belegnummer/release', { date: dateStr, number });
|
||||
},
|
||||
|
||||
printPreview: async (attachmentId: number, barcodeData: any): Promise<Blob> => {
|
||||
const res = await api.post(`/api/email-import/attachments/${attachmentId}/print-preview`, barcodeData, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
return res.data;
|
||||
},
|
||||
|
||||
executeImport: async (emailDate: string, attachments: AttachmentImportData[]): Promise<{ success: boolean; results: any[] }> => {
|
||||
const res = await api.post('/api/email-import/execute', { emailDate, attachments });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
ensurePreviews: async (emailId: number): Promise<void> => {
|
||||
await api.post(`/api/email-import/emails/${emailId}/ensure-previews`);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user