diff --git a/trip-service/server.js b/trip-service/server.js index 2a6db59..01de3c4 100644 --- a/trip-service/server.js +++ b/trip-service/server.js @@ -165,6 +165,21 @@ app.get('/trips', (req, res) => { res.json(loadTrips()); }); +app.post('/trips/:id/test', async (req, res) => { + const trips = loadTrips(); + const trip = trips.find(t => t.id === req.params.id); + if (!trip) return res.status(404).json({ error: 'Trip not found' }); + + // Just use the first day's plan for the test + const dayPlan = trip.days[0]; + try { + await generateAndSendBriefing(trip, dayPlan); + res.json({ success: true, message: 'Test briefing sent!' }); + } catch (err) { + res.status(500).json({ error: err.message }); + } +}); + app.get('/health', (req, res) => res.json({ status: 'ok' })); // ── Scheduler (Runs every minute, checks if time to send) ────────────────────