2019-05-14 07:08:35 -05:00
|
|
|
import $ from 'cafy';
|
|
|
|
import define from '../../../define';
|
2019-05-27 02:54:47 -05:00
|
|
|
import { deleteFile } from '../../../../../services/drive/delete-file';
|
2019-05-14 07:08:35 -05:00
|
|
|
import { DriveFiles } from '../../../../../models';
|
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
params: {
|
|
|
|
host: {
|
|
|
|
validator: $.str
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default define(meta, async (ps, me) => {
|
|
|
|
const files = await DriveFiles.find({
|
|
|
|
userHost: ps.host
|
|
|
|
});
|
|
|
|
|
|
|
|
for (const file of files) {
|
2019-05-27 02:54:47 -05:00
|
|
|
deleteFile(file);
|
2019-05-14 07:08:35 -05:00
|
|
|
}
|
|
|
|
});
|