feat: extend frontend API client for Agrarmonitor polling
- Add SettingClient interface and getClients/updateClient methods - Add AgrarmonitorPollingConfig/Result interfaces - Add getPollingConfig, updatePollingConfig, runPolling to agrarmonitorApi Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,13 @@ export interface SettingUserClient {
|
||||
Role: 'viewer' | 'editor' | 'admin';
|
||||
}
|
||||
|
||||
export interface SettingClient {
|
||||
Id: number;
|
||||
Name: string;
|
||||
PaperlessUserId: number;
|
||||
AgrarmonitorBetriebId: number | null;
|
||||
}
|
||||
|
||||
export const settingsApi = {
|
||||
// Dokumenttypen
|
||||
getDocTypes: () => api.get<SettingDocType[]>('/api/settings/document-types').then(r => r.data),
|
||||
@@ -144,6 +151,11 @@ export const settingsApi = {
|
||||
updateCorrespondentSetting: (id: number, agrarmonitorId: number | null) =>
|
||||
api.put<any>(`/api/settings/correspondents/${id}`, { agrarmonitorId }).then(r => r.data),
|
||||
|
||||
// Betriebe
|
||||
getClients: () => api.get<SettingClient[]>('/api/settings/clients').then(r => r.data),
|
||||
updateClient: (id: number, AgrarmonitorBetriebId: number | null) =>
|
||||
api.put<SettingClient>(`/api/settings/clients/${id}`, { AgrarmonitorBetriebId }).then(r => r.data),
|
||||
|
||||
// Inbox-Postprozessor (global, deprecated)
|
||||
listInboxActions: () =>
|
||||
api.get<InboxAction[]>('/api/settings/inbox-actions').then((r) => r.data),
|
||||
@@ -184,6 +196,18 @@ export interface AgrarmonitorStatusData {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface AgrarmonitorPollingConfig {
|
||||
tagFertig: string;
|
||||
tagVerbucht: string;
|
||||
}
|
||||
|
||||
export interface AgrarmonitorPollingResult {
|
||||
processed: number;
|
||||
updated: number;
|
||||
skipped: number;
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
export const agrarmonitorApi = {
|
||||
getStatus: () =>
|
||||
api.get<AgrarmonitorStatusData>('/api/agrarmonitor/status').then((r) => r.data),
|
||||
@@ -191,4 +215,10 @@ export const agrarmonitorApi = {
|
||||
api
|
||||
.post<{ success: boolean; message: string }>('/api/agrarmonitor/register', { pcName, agrarmonitorId })
|
||||
.then((r) => r.data),
|
||||
getPollingConfig: () =>
|
||||
api.get<AgrarmonitorPollingConfig>('/api/agrarmonitor/polling-config').then((r) => r.data),
|
||||
updatePollingConfig: (config: AgrarmonitorPollingConfig) =>
|
||||
api.put<AgrarmonitorPollingConfig>('/api/agrarmonitor/polling-config', config).then((r) => r.data),
|
||||
runPolling: () =>
|
||||
api.post<AgrarmonitorPollingResult>('/api/agrarmonitor/run-polling').then((r) => r.data),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user