mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-27 05:36:44 -06:00
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);
|
||
|
}));
|