mirror of
https://github.com/MisskeyIO/misskey
synced 2025-01-06 18:03:30 +09:00
d2a7c56149
Resolve #3789 Resolve #3790
29 lines
551 B
TypeScript
29 lines
551 B
TypeScript
import $ from 'cafy';
|
|
import ID, { transform } from '../../../../../misc/cafy-id';
|
|
import define from '../../../define';
|
|
import DriveFile from '../../../../../models/drive-file';
|
|
|
|
export const meta = {
|
|
requireCredential: true,
|
|
requireModerator: true,
|
|
|
|
params: {
|
|
fileId: {
|
|
validator: $.type(ID),
|
|
transform: transform,
|
|
},
|
|
}
|
|
};
|
|
|
|
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
|
const file = await DriveFile.findOne({
|
|
_id: ps.fileId
|
|
});
|
|
|
|
if (file == null) {
|
|
return rej('file not found');
|
|
}
|
|
|
|
res(file);
|
|
}));
|