ca-grow-ops-manager/backend/src/routes/walkthrough.routes.ts
fullsizemalt c7f8bc8cec
Some checks are pending
Deploy to Production / deploy (push) Waiting to run
Test / backend-test (push) Waiting to run
Test / frontend-test (push) Waiting to run
feat: walkthrough 'completed today' status + 3D viewer spec
- Added /walkthroughs/today API endpoint
- Show clear status when walkthrough is already completed
- Show 'Continue Walkthrough' for in-progress ones
- Added facility-3d-viewer.md spec
- Installed React Three Fiber dependencies
2025-12-12 22:17:10 -08:00

35 lines
1 KiB
TypeScript

import { FastifyInstance } from 'fastify';
import {
createWalkthrough,
getWalkthroughs,
getWalkthrough,
getTodaysWalkthrough,
completeWalkthrough,
addReservoirCheck,
addIrrigationCheck,
addPlantHealthCheck,
} from '../controllers/walkthrough.controller';
export async function walkthroughRoutes(server: FastifyInstance) {
// Auth middleware
server.addHook('onRequest', async (request) => {
try {
await request.jwtVerify();
} catch (err) {
throw err;
}
});
// Walkthrough CRUD
server.post('/', createWalkthrough);
server.get('/', getWalkthroughs);
server.get('/today', getTodaysWalkthrough); // Must come before /:id
server.get('/:id', getWalkthrough);
server.post('/:id/complete', completeWalkthrough);
// Add checks to walkthrough
server.post('/:id/reservoir-checks', addReservoirCheck);
server.post('/:id/irrigation-checks', addIrrigationCheck);
server.post('/:id/plant-health-checks', addPlantHealthCheck);
}