The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/statistics/server/functions/getLastStatistics.js

14 lines
446 B

import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { statistics } from '../lib/statistics';
import { Statistics } from '../../../models/server/raw';
export async function getLastStatistics({ userId, refresh }) {
if (!await hasPermissionAsync(userId, 'view-statistics')) {
throw new Error('error-not-allowed');
}
if (refresh) {
return statistics.save();
}
return Statistics.findLast();
}