F4: add document delivery client without Director

This commit is contained in:
2026-09-07 23:13:41 -03:00
parent 8d962e783d
commit 2319d06685
+51
View File
@@ -0,0 +1,51 @@
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' });
}