- Add Capacitor core, CLI, and Android platform - Install plugins: camera, push-notifications, splash-screen, status-bar - Configure capacitor.config.ts with app ID run.runfoo.veridian - Update vite.config.ts with base: './' for Capacitor compatibility - Update api.ts and SessionTimeoutWarning.tsx to detect Capacitor and use production API URL - Generate Android project structure with Gradle build files
30 lines
809 B
TypeScript
30 lines
809 B
TypeScript
import { FastifyInstance } from 'fastify';
|
|
import {
|
|
getCameras,
|
|
getCameraById,
|
|
getCameraStream,
|
|
createCamera,
|
|
updateCamera,
|
|
deleteCamera,
|
|
updateCameraStatus
|
|
} from '../controllers/cameras.controller';
|
|
|
|
export async function cameraRoutes(server: FastifyInstance) {
|
|
// Auth required for all routes
|
|
server.addHook('onRequest', async (request) => {
|
|
try {
|
|
await request.jwtVerify();
|
|
} catch (err) {
|
|
throw err;
|
|
}
|
|
});
|
|
|
|
// CRUD Routes
|
|
server.get('/', getCameras);
|
|
server.get('/:id', getCameraById);
|
|
server.get('/:id/stream', getCameraStream);
|
|
server.post('/', createCamera);
|
|
server.put('/:id', updateCamera);
|
|
server.delete('/:id', deleteCamera);
|
|
server.patch('/:id/status', updateCameraStatus);
|
|
}
|