import { Router } from "express";

import { prisma } from "@repo/db";

const router: Router = Router();

router.put("/", async (req, res) => {
	try {
		const report = await prisma.report.create({
			data: req.body,
		});

		// TODO: send link to report on admin page to user

		res.json(report);
	} catch (error) {
		res.status(500).json({
			message: "Error creating report",
			error: error instanceof Error ? error.message : String(error),
		});
	}
});

export default router;
