Implement admin drive page

This commit is contained in:
syuilo 2018-12-14 19:09:11 +09:00
parent 8bd17703c3
commit 796237b3c6
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
4 changed files with 231 additions and 4 deletions

View file

@ -1,6 +1,7 @@
import * as mongo from 'mongodb';
const deepcopy = require('deepcopy');
import { pack as packFolder } from './drive-folder';
import { pack as packUser } from './user';
import monkDb, { nativeDbConn } from '../db/mongodb';
import isObjectId from '../misc/is-objectid';
import getDriveFileUrl, { getOriginalUrl } from '../misc/get-drive-file-url';
@ -131,6 +132,7 @@ export const packMany = (
options?: {
detail?: boolean
self?: boolean,
withUser?: boolean,
}
) => {
return Promise.all(files.map(f => pack(f, options)));
@ -144,6 +146,7 @@ export const pack = (
options?: {
detail?: boolean,
self?: boolean,
withUser?: boolean,
}
) => new Promise<any>(async (resolve, reject) => {
const opts = Object.assign({
@ -208,6 +211,11 @@ export const pack = (
*/
}
if (opts.withUser) {
// Populate user
_target.user = await packUser(_file.metadata.userId);
}
delete _target.withoutChunks;
delete _target.storage;
delete _target.storageProps;