mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-13 15:03:09 +02:00
33 lines
618 B
TypeScript
33 lines
618 B
TypeScript
|
import $ from 'cafy';
|
||
|
import ID, { transform } from '../../../../misc/cafy-id';
|
||
|
import define from '../../define';
|
||
|
import AbuseUserReport from '../../../../models/abuse-user-report';
|
||
|
|
||
|
export const meta = {
|
||
|
requireCredential: true,
|
||
|
requireModerator: true,
|
||
|
|
||
|
params: {
|
||
|
reportId: {
|
||
|
validator: $.type(ID),
|
||
|
transform: transform
|
||
|
},
|
||
|
}
|
||
|
};
|
||
|
|
||
|
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||
|
const report = await AbuseUserReport.findOne({
|
||
|
_id: ps.reportId
|
||
|
});
|
||
|
|
||
|
if (report == null) {
|
||
|
return rej('report not found');
|
||
|
}
|
||
|
|
||
|
await AbuseUserReport.remove({
|
||
|
_id: report._id
|
||
|
});
|
||
|
|
||
|
res();
|
||
|
}));
|