All checks were successful
Build & Deploy / deploy (push) Successful in 25s
Neuer Endpunkt POST /api/batch/build (Token) und Cron (03:00 Europe/Berlin): buendelt offene batch_submissions JE ZUGANG (api_client) zu einer xlsx (Schema Firma/Vorname/Nachname/Zeile1-3/PLZ/Stadt/Land) + einer Sammel- Druck-PDF (alle mitgelieferten Druck-PDFs 1:1) und laedt beide per FTP(S) in die Wurzel. Dateiname <api_client_id>_<YYYY-MM-DD>(.xlsx/.pdf); manuelle Laeufe mit Uhrzeit-Suffix (kein Ueberschreiben des Tageslaufs). Text-only- Datensaetze (ohne PDF) bleiben offen (manuelle Schreibvorlage), nicht im Buendel. Sa+So gemeinsam am Montag (Sonntag-Lauf uebersprungen). Neue Pakete: exceljs, basic-ftp. FTP-Config via ENV (SKRIFT_FTP_HOST/PORT/ USER/PASSWORD/SECURE), Passwort nur in ENV. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
15 lines
585 B
JavaScript
15 lines
585 B
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const { authenticateApiToken } = require('../middleware/auth');
|
|
const batchController = require('../controllers/batch-controller');
|
|
|
|
/**
|
|
* POST /api/batch/build
|
|
* Bündelt offene batch_submissions (xlsx + Sammel-Druck-PDF) und lädt sie per FTP
|
|
* hoch. Body: { client_id?, label?, time_suffix? }. Ohne client_id → alle Zugänge.
|
|
* Wird vom Directus-Knopf (ein Zugang, sofort) und intern vom Cron genutzt.
|
|
*/
|
|
router.post('/build', authenticateApiToken, batchController.buildBundles);
|
|
|
|
module.exports = router;
|