* docs: category & description for reset password * docs: category & description for testing * docs: descriptions for groups endpoints * docs: descriptions for drive file endpoints * docs: descriptions for sw endpoints * docs: descriptions for user list endpoints * docs: descriptions & result type for gallery posts * docs: descriptions & result type for user endpoints * docs: add return type for stats
35 lines
652 B
TypeScript
35 lines
652 B
TypeScript
import define from '../../../define.js';
|
|
import { DriveFiles } from '@/models/index.js';
|
|
|
|
export const meta = {
|
|
tags: ['drive'],
|
|
|
|
requireCredential: true,
|
|
|
|
kind: 'read:drive',
|
|
|
|
description: 'Check if a given file exists.',
|
|
|
|
res: {
|
|
type: 'boolean',
|
|
optional: false, nullable: false,
|
|
},
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {
|
|
md5: { type: 'string' },
|
|
},
|
|
required: ['md5'],
|
|
} as const;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
export default define(meta, paramDef, async (ps, user) => {
|
|
const file = await DriveFiles.findOneBy({
|
|
md5: ps.md5,
|
|
userId: user.id,
|
|
});
|
|
|
|
return file != null;
|
|
});
|