mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 05: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
38 lines
731 B
TypeScript
38 lines
731 B
TypeScript
import $ from 'cafy';
|
|
import ID, { transform } from '../../../../../misc/cafy-id';
|
|
import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
|
import define from '../../../define';
|
|
|
|
export const meta = {
|
|
tags: ['drive'],
|
|
|
|
requireCredential: true,
|
|
|
|
kind: 'drive-read',
|
|
|
|
params: {
|
|
name: {
|
|
validator: $.str
|
|
},
|
|
|
|
parentId: {
|
|
validator: $.optional.nullable.type(ID),
|
|
transform: transform,
|
|
default: null as any,
|
|
desc: {
|
|
'ja-JP': 'フォルダID'
|
|
}
|
|
},
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, user) => {
|
|
const folders = await DriveFolder
|
|
.find({
|
|
name: ps.name,
|
|
userId: user._id,
|
|
parentId: ps.parentId
|
|
});
|
|
|
|
return await Promise.all(folders.map(folder => pack(folder)));
|
|
});
|