feat: add test endpoint to trip service

This commit is contained in:
Antigravity 2026-05-29 14:58:21 -04:00
parent 1a8695c836
commit 5067b2569e
1 changed files with 15 additions and 0 deletions

View File

@ -165,6 +165,21 @@ app.get('/trips', (req, res) => {
res.json(loadTrips()); 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' })); app.get('/health', (req, res) => res.json({ status: 'ok' }));
// ── Scheduler (Runs every minute, checks if time to send) ──────────────────── // ── Scheduler (Runs every minute, checks if time to send) ────────────────────