mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 02:03:09 +02:00
52774bbe64
* wip * wip * wip * Update index.ts * Update gen-openapi-spec.ts * Update api.ja-JP.md * Fix * Improve doc * Update gen-openapi-spec.ts * Update redoc.html * Improve doc * Update gen-openapi-spec.ts * Improve doc * Update CHANGELOG.md
35 lines
822 B
TypeScript
35 lines
822 B
TypeScript
import $ from 'cafy';
|
|
import DriveFile, { pack } from '../../../../../models/drive-file';
|
|
import define from '../../../define';
|
|
|
|
export const meta = {
|
|
desc: {
|
|
'ja-JP': '与えられたMD5ハッシュ値を持つファイルがドライブに存在するかどうかを返します。',
|
|
'en-US': 'Returns whether the file with the given MD5 hash exists in the user\'s drive.'
|
|
},
|
|
|
|
tags: ['drive'],
|
|
|
|
requireCredential: true,
|
|
|
|
kind: 'drive-read',
|
|
|
|
params: {
|
|
md5: {
|
|
validator: $.str,
|
|
desc: {
|
|
'ja-JP': 'ファイルのMD5ハッシュ'
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, user) => {
|
|
const file = await DriveFile.findOne({
|
|
md5: ps.md5,
|
|
'metadata.userId': user._id,
|
|
'metadata.deletedAt': { $exists: false }
|
|
});
|
|
|
|
return { file: file ? await pack(file, { self: true }) : null };
|
|
});
|