Use any instead of Object
This commit is contained in:
parent
d2c70afd37
commit
ac8eb94a27
81 changed files with 398 additions and 397 deletions
|
|
@ -8,30 +8,33 @@ import DriveFile from '../models/drive-file';
|
|||
/**
|
||||
* Get drive information
|
||||
*
|
||||
* @param {Object} params
|
||||
* @param {Object} user
|
||||
* @return {Promise<object>}
|
||||
* @param {any} params
|
||||
* @param {any} user
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
module.exports = (params, user) =>
|
||||
new Promise(async (res, rej) =>
|
||||
{
|
||||
// Calculate drive usage
|
||||
const usage = ((await DriveFile
|
||||
.aggregate([
|
||||
{ $match: { user_id: user._id } },
|
||||
{ $project: {
|
||||
datasize: true
|
||||
}},
|
||||
{ $group: {
|
||||
_id: null,
|
||||
usage: { $sum: '$datasize' }
|
||||
}}
|
||||
]))[0] || {
|
||||
usage: 0
|
||||
}).usage;
|
||||
new Promise(async (res, rej) => {
|
||||
// Calculate drive usage
|
||||
const usage = ((await DriveFile
|
||||
.aggregate([
|
||||
{ $match: { user_id: user._id } },
|
||||
{
|
||||
$project: {
|
||||
datasize: true
|
||||
}
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: null,
|
||||
usage: { $sum: '$datasize' }
|
||||
}
|
||||
}
|
||||
]))[0] || {
|
||||
usage: 0
|
||||
}).usage;
|
||||
|
||||
res({
|
||||
capacity: user.drive_capacity,
|
||||
usage: usage
|
||||
res({
|
||||
capacity: user.drive_capacity,
|
||||
usage: usage
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue