52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { apiRequest } from './api';
|
|
|
|
export interface DocumentDeliverySettingsF4 {
|
|
officeEmail: string | null;
|
|
smtpConfigured: boolean;
|
|
mailFrom: string | null;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export interface DocumentDeliveryItemF4 {
|
|
id: string;
|
|
actId: string;
|
|
reportId: string | null;
|
|
documentKind: 'ACT_PDF' | 'REPORT_WORD';
|
|
recipientKind: 'COMPANY' | 'OFFICE' | 'INSPECTOR';
|
|
recipientAssetId: string | null;
|
|
recipientUserId: string | null;
|
|
recipientEmail: string | null;
|
|
recipientAssetName?: string | null;
|
|
recipientUserName?: string | null;
|
|
status: 'PENDING' | 'WAITING_RECIPIENT' | 'WAITING_TRANSPORT' | 'WAITING_ARTIFACT' | 'SENT' | 'FAILED';
|
|
attempts: number;
|
|
lastAttemptAt?: string | null;
|
|
sentAt?: string | null;
|
|
lastError?: string | null;
|
|
actCode: string;
|
|
reportCode: string | null;
|
|
}
|
|
|
|
export function getDocumentDeliverySettingsF4() {
|
|
return apiRequest<DocumentDeliverySettingsF4>('/document-delivery/settings');
|
|
}
|
|
|
|
export function updateDocumentDeliverySettingsF4(officeEmail: string | null) {
|
|
return apiRequest<DocumentDeliverySettingsF4>('/document-delivery/settings', {
|
|
method: 'PATCH',
|
|
body: JSON.stringify({ officeEmail }),
|
|
});
|
|
}
|
|
|
|
export function listDocumentDeliveriesF4() {
|
|
return apiRequest<{ data: DocumentDeliveryItemF4[] }>('/document-delivery/outbox');
|
|
}
|
|
|
|
export function retryDocumentDeliveryF4(id: string) {
|
|
return apiRequest<DocumentDeliveryItemF4>(`/document-delivery/outbox/${id}/retry`, { method: 'POST' });
|
|
}
|
|
|
|
export function retryPendingDocumentDeliveriesF4() {
|
|
return apiRequest<{ processed: number }>('/document-delivery/outbox/retry-pending', { method: 'POST' });
|
|
}
|