ハイフンに統一
This commit is contained in:
parent
664acb2d0e
commit
f4ae939124
18 changed files with 4 additions and 0 deletions
35
src/server/api/endpoints/drive/files/check-existence.ts
Normal file
35
src/server/api/endpoints/drive/files/check-existence.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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 };
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue