Sharkey/src/server/api/endpoints/admin/federation/delete-all-files.ts
2019-05-27 16:54:47 +09:00

27 lines
499 B
TypeScript

import $ from 'cafy';
import define from '../../../define';
import { deleteFile } from '../../../../../services/drive/delete-file';
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) {
deleteFile(file);
}
});