Added entity reporting.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Router } from 'express';
|
||||
|
||||
import { createReport, updateReport } from '../reports.js';
|
||||
|
||||
async function createReportApi(req, res) {
|
||||
const reportId = await createReport(Number(req.params.entityId), req.body, req.user);
|
||||
|
||||
res.send({ id: reportId });
|
||||
}
|
||||
|
||||
async function updateReportApi(req, res) {
|
||||
const report = await updateReport(Number(req.params.reportId), req.body, req.user);
|
||||
|
||||
res.send(report);
|
||||
}
|
||||
|
||||
export const router = Router();
|
||||
|
||||
router.post('/api/entities/:entityId/reports', createReportApi);
|
||||
router.patch('/api/reports/:reportId', updateReportApi);
|
||||
Reference in New Issue
Block a user