ca-grow-ops-manager/backend/src/routes/rooms.routes.ts
fullsizemalt eb5ebc610f
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: room cards with color-coded headers + room detail page
- Room cards now have colored header backgrounds per type (VEG=green, FLOWER=purple, DRY=amber, CURE=orange, etc.)
- Cards are clickable, linking to /rooms/:id
- New RoomDetailPage with gradient header, sensor metrics with sparklines, active batches list
- Backend: GET /rooms/:id endpoint returns room with batches
2025-12-12 19:33:07 -08:00

19 lines
640 B
TypeScript

import { FastifyInstance } from 'fastify';
import { getRooms, getRoomById, createRoom } from '../controllers/rooms.controller';
export async function roomRoutes(server: FastifyInstance) {
server.addHook('onRequest', async (request) => {
try {
await request.jwtVerify();
} catch (err) {
// Allow public access for now if needed, or enforce strict
// For Phase 1, strict auth except maybe seeded user
// server.log.error(err);
throw err;
}
});
server.get('/', getRooms);
server.get('/:id', getRoomById);
server.post('/', createRoom);
}