Batch-Buendelung: gezielte Auswahl per ids (FTP-Upload aus dem Board)
All checks were successful
Build & Deploy / deploy (push) Successful in 11s

/api/batch/build akzeptiert jetzt ids:[...] und buendelt genau diese
Uebermittlungen (je Zugang, xlsx + Sammel-PDF + FTP). Der Board-Knopf
"Per FTP hochladen" wirkt damit auf die Auswahl.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
s4luorth
2026-09-28 10:23:58 +02:00
parent a6eb41f996
commit 94751c12ff
2 changed files with 8 additions and 6 deletions

View File

@@ -96,8 +96,8 @@ async function buendleZugang(clientId, subs, label, zeitSuffix) {
}
/** Bündelt alle offenen Datensätze (optional nur ein Zugang), gruppiert je Zugang. */
async function buendleAlle({ clientId = null, label, zeitSuffix = '' }) {
const alle = await fetchBatchPending(clientId);
async function buendleAlle({ clientId = null, ids = null, label, zeitSuffix = '' }) {
const alle = await fetchBatchPending(clientId, ids);
const proZugang = new Map();
for (const s of alle) {
const k = String(s.api_client);
@@ -117,12 +117,13 @@ async function buendleAlle({ clientId = null, label, zeitSuffix = '' }) {
async function buildBundles(req, res) {
try {
const clientId = (req.body && req.body.client_id != null && String(req.body.client_id).trim()) ? String(req.body.client_id).trim() : null;
const ids = (req.body && Array.isArray(req.body.ids) && req.body.ids.length) ? req.body.ids : null;
const label = (req.body && req.body.label) ? String(req.body.label) : berlinParts().date;
// Manuelle Bündelung mit Uhrzeit-Suffix, damit sie den Cron-Tageslauf (nur Datum) nicht überschreibt.
const zeitSuffix = (req.body && req.body.time_suffix !== undefined)
? String(req.body.time_suffix)
: `${String(berlinParts().hour).padStart(2, '0')}${String(berlinParts().minute).padStart(2, '0')}`;
const ergebnis = await buendleAlle({ clientId, label, zeitSuffix });
const ergebnis = await buendleAlle({ clientId, ids, label, zeitSuffix });
return res.json({ ok: true, bundles: ergebnis });
} catch (err) {
console.error('[batch] build fehlgeschlagen:', err);