mirror of
https://github.com/nfonteyne/octane-website.git
synced 2026-09-03 23:24:48 +02:00
update: better view concert history
This commit is contained in:
parent
0773f39763
commit
a09d16238b
7 changed files with 80 additions and 26 deletions
|
|
@ -78,12 +78,16 @@ router.post('/refresh', (req, res) => {
|
|||
|
||||
const data = await response.json();
|
||||
if (!Array.isArray(data.slots)) {
|
||||
console.error('[calendar] n8n response had no "slots" array. Raw body:', JSON.stringify(data).slice(0, 500));
|
||||
workflowState.setError('Unexpected response format from n8n');
|
||||
return;
|
||||
}
|
||||
|
||||
await calendarRepo.ingestSlots(data.slots);
|
||||
workflowState.setSuccess();
|
||||
const summary = await calendarRepo.ingestSlots(data.slots);
|
||||
workflowState.setSuccess(
|
||||
`${summary.slotsProcessed} créneaux reçus, ${summary.availabilityRows} disponibilités enregistrées` +
|
||||
(summary.slotsWithNoPeople > 0 ? ` (${summary.slotsWithNoPeople} créneaux sans aucune personne — voir les logs serveur)` : '')
|
||||
);
|
||||
} catch (err) {
|
||||
clearTimeout(watchdog);
|
||||
const message = err.name === 'AbortError' ? 'n8n did not respond within 5 minutes' : err.message;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ router.post(
|
|||
return res.status(400).json({ error: 'expected_array_of_slots' });
|
||||
}
|
||||
try {
|
||||
await calendarRepo.ingestSlots(slots);
|
||||
workflowState.setSuccess();
|
||||
res.json({ ok: true, count: slots.length });
|
||||
const summary = await calendarRepo.ingestSlots(slots);
|
||||
workflowState.setSuccess(
|
||||
`${summary.slotsProcessed} créneaux reçus, ${summary.availabilityRows} disponibilités enregistrées`
|
||||
);
|
||||
res.json({ ok: true, ...summary });
|
||||
} catch (err) {
|
||||
workflowState.setError(err.message);
|
||||
res.status(500).json({ error: err.message });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue