import { FastifyInstance } from "fastify"; import { MatchingEngine } from "@shieldai/darkwatch"; export function exposureRoutes(fastify: FastifyInstance) { const engine = new MatchingEngine(); fastify.get("/", async (request, reply) => { const userId = (request.user as { id: string })?.id; if (!userId) { return reply.code(401).send({ error: "User not authenticated" }); } const exposures = await engine.getExposuresForUser(userId); return reply.send(exposures); }); fastify.get("/:id", async (request, reply) => { const exposure = await engine.getExposureById(request.params.id); if (!exposure) { return reply.code(404).send({ error: "Exposure not found" }); } return reply.send(exposure); }); }