Backend: - Add getBatchById controller with touch points and IPM schedule - Add GET /batches/:id route Frontend: - Update Batch interface to include touchPoints - BatchDetailPage now uses real touch points from API - Better error handling on batch load failure
17 lines
526 B
TypeScript
17 lines
526 B
TypeScript
import { FastifyInstance } from 'fastify';
|
|
import { getBatches, getBatchById, createBatch, updateBatch } from '../controllers/batches.controller';
|
|
|
|
export async function batchRoutes(server: FastifyInstance) {
|
|
server.addHook('onRequest', async (request) => {
|
|
try {
|
|
await request.jwtVerify();
|
|
} catch (err) {
|
|
throw err;
|
|
}
|
|
});
|
|
|
|
server.get('/', getBatches);
|
|
server.get('/:id', getBatchById);
|
|
server.post('/', createBatch);
|
|
server.put('/:id', updateBatch);
|
|
}
|