mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-29 12:43:09 +02:00
d2a7c56149
Resolve #3789 Resolve #3790
28 lines
551 B
TypeScript
28 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);
|
|
}));
|