- 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
35 lines
1 KiB
TypeScript
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);
|
|
}
|
|
|