paricafe/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts

28 lines
492 B
TypeScript
Raw Normal View History

import $ from 'cafy';
import define from '../../../define';
import { deleteFile } from '@/services/drive/delete-file';
import { DriveFiles } from '@/models/index';
export const meta = {
tags: ['admin'],
2020-02-15 06:33:32 -06:00
requireCredential: true as const,
requireModerator: true,
params: {
host: {
2021-12-09 08:58:30 -06:00
validator: $.str,
},
},
};
export default define(meta, async (ps, me) => {
const files = await DriveFiles.find({
2021-12-09 08:58:30 -06:00
userHost: ps.host,
});
for (const file of files) {
2019-05-27 02:54:47 -05:00
deleteFile(file);
}
});