monkeeShark/src/server/api/endpoints/admin/remove-abuse-user-report.ts

35 lines
616 B
TypeScript
Raw Normal View History

2019-01-19 10:16:48 +00:00
import $ from 'cafy';
import ID, { transform } from '../../../../misc/cafy-id';
import define from '../../define';
import AbuseUserReport from '../../../../models/abuse-user-report';
export const meta = {
tags: ['admin'],
2019-01-19 10:16:48 +00:00
requireCredential: true,
requireModerator: true,
params: {
reportId: {
validator: $.type(ID),
transform: transform
},
}
};
export default define(meta, async (ps) => {
2019-01-19 10:16:48 +00:00
const report = await AbuseUserReport.findOne({
_id: ps.reportId
});
if (report == null) {
throw new Error('report not found');
2019-01-19 10:16:48 +00:00
}
await AbuseUserReport.remove({
_id: report._id
});
return;
});