mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-14 00:46:38 -05:00
13 lines
455 B
JavaScript
13 lines
455 B
JavaScript
|
const ModelPath = '../../models/';
|
||
|
const User = require(ModelPath + 'User.js');
|
||
|
const Key = require(ModelPath + 'Key.js');
|
||
|
|
||
|
const updateStats = req =>
|
||
|
Promise.all([
|
||
|
User.updateOne({username: req.username}, {$inc: {uploadCount: 1, uploadSize: req.file.size}}),
|
||
|
req.key
|
||
|
? Key.updateOne({key: req.key}, {$inc: {uploadCount: 1, uploadSize: req.file.size}})
|
||
|
: Promise.resolve()
|
||
|
]);
|
||
|
|
||
|
module.exports = updateStats;
|