added reports page
This commit is contained in:
24
apps/dispatch-server/routes/report.ts
Normal file
24
apps/dispatch-server/routes/report.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Router } from "express";
|
||||
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
const 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;
|
||||
Reference in New Issue
Block a user