feat: add audit logging to admin actions
Made-with: Cursor
This commit is contained in:
@@ -91,8 +91,9 @@ export async function adminQuestionsRoutes(app: FastifyInstance) {
|
||||
preHandler: [app.authenticate, app.authenticateAdmin],
|
||||
},
|
||||
async (req, reply) => {
|
||||
const adminId = req.user!.id;
|
||||
const { questionId } = req.params as { questionId: string };
|
||||
await adminQuestionService.approve(questionId);
|
||||
await adminQuestionService.approve(questionId, adminId);
|
||||
return reply.status(204).send();
|
||||
},
|
||||
);
|
||||
@@ -105,8 +106,9 @@ export async function adminQuestionsRoutes(app: FastifyInstance) {
|
||||
preHandler: [app.authenticate, app.authenticateAdmin],
|
||||
},
|
||||
async (req, reply) => {
|
||||
const adminId = req.user!.id;
|
||||
const { questionId } = req.params as { questionId: string };
|
||||
await adminQuestionService.reject(questionId);
|
||||
await adminQuestionService.reject(questionId, adminId);
|
||||
return reply.status(204).send();
|
||||
},
|
||||
);
|
||||
@@ -119,9 +121,10 @@ export async function adminQuestionsRoutes(app: FastifyInstance) {
|
||||
preHandler: [app.authenticate, app.authenticateAdmin],
|
||||
},
|
||||
async (req, reply) => {
|
||||
const adminId = req.user!.id;
|
||||
const { questionId } = req.params as { questionId: string };
|
||||
const body = req.body as EditQuestionInput;
|
||||
const question = await adminQuestionService.edit(questionId, body);
|
||||
const question = await adminQuestionService.edit(questionId, body, adminId);
|
||||
return reply.send(question);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user