feat: add test endpoint to trip service
This commit is contained in:
parent
1a8695c836
commit
5067b2569e
|
|
@ -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) ────────────────────
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue