0765d14d3b
Build and Push Multi-Platform Images / build-and-push (push) Successful in 39s
Belege, die per E-Mail an Agrarmonitor gesendet werden, brauchen bis zu 10 Minuten bis zum Import in den Dateieingang. Bisher wurden sie im Upload-Check sofort als "Manuell bearbeiten" + Tag 19 markiert, wenn sie weder verbucht noch im Dateieingang waren – auch mitten im Import-Fenster. Jetzt wird vor dem Markieren geprüft, ob die jüngste Notiz mit dem konfigurierbaren Marker-Text jünger als die Wartezeit ist; falls ja, wird der Beleg übersprungen und beim nächsten Lauf erneut geprüft. Wartezeit (agrarmonitor_import_wartezeit_minuten, Standard 10) und Marker (agrarmonitor_notiz_marker, Standard "Agrarmonitor") sind als Settings konfigurierbar und in der Settings-Seite editierbar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import { Body, Controller, Get, HttpCode, Post, Put } from '@nestjs/common';
|
|
import { AgrarmonitorService } from './agrarmonitor.service';
|
|
import { AgrarmonitorPollingService } from './agrarmonitor-polling.service';
|
|
import { RequirePermissions } from '../auth/permissions.decorator';
|
|
import { Permission } from '../auth/permissions.enum';
|
|
|
|
@Controller('api/agrarmonitor')
|
|
export class AgrarmonitorController {
|
|
constructor(
|
|
private readonly service: AgrarmonitorService,
|
|
private readonly pollingService: AgrarmonitorPollingService,
|
|
) {}
|
|
|
|
@Get('status')
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async getStatus() {
|
|
return this.service.getStatus();
|
|
}
|
|
|
|
@Post('register')
|
|
@HttpCode(200)
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async registerDevice(
|
|
@Body() body: { pcName: string; agrarmonitorId: string },
|
|
) {
|
|
return this.service.registerDevice(body.pcName, body.agrarmonitorId);
|
|
}
|
|
|
|
@Get('polling-config')
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async getPollingConfig() {
|
|
return this.pollingService.getPollingConfig();
|
|
}
|
|
|
|
@Put('polling-config')
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async updatePollingConfig(
|
|
@Body()
|
|
body: {
|
|
tagFertig: string;
|
|
tagVerbucht: string;
|
|
tagHochgeladen: string;
|
|
linkField: string;
|
|
tagManuell: string;
|
|
importWartezeitMinuten: string;
|
|
notizMarker: string;
|
|
},
|
|
) {
|
|
return this.pollingService.updatePollingConfig(
|
|
body.tagFertig,
|
|
body.tagVerbucht,
|
|
body.tagHochgeladen,
|
|
body.linkField,
|
|
body.tagManuell ?? '',
|
|
body.importWartezeitMinuten ?? '10',
|
|
body.notizMarker ?? 'Agrarmonitor',
|
|
);
|
|
}
|
|
|
|
@Post('run-polling')
|
|
@HttpCode(200)
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async runPolling() {
|
|
return this.pollingService.runPolling();
|
|
}
|
|
|
|
@Post('process-uploads')
|
|
@HttpCode(200)
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async processUploads() {
|
|
return this.pollingService.processVerarbeiteteDocuments();
|
|
}
|
|
|
|
@Post('sync-correspondents')
|
|
@HttpCode(200)
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async syncCorrespondents() {
|
|
return this.pollingService.syncCorrespondentIds();
|
|
}
|
|
|
|
@Post('merge-correspondents')
|
|
@HttpCode(200)
|
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
async mergeCorrespondents(
|
|
@Body() body: { keepId: number; deleteId: number },
|
|
) {
|
|
return this.pollingService.mergeCorrespondents(body.keepId, body.deleteId);
|
|
}
|
|
}
|