Build Filter with userID in statistics
MODIFY
src/server/rest/v1/service/StatisticService.ts
src/server/rest/v1/service/StatisticService.ts
-/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
+/* eslint-disable */
import { Action, Entity } from '../../../../types/Authorization';
import { NextFunction, Request, Response } from 'express';
import StatisticFilter, { ChargingStationStats, StatsDataCategory, StatsDataScope, StatsDataType, StatsGroupBy, UserStats } from '../../../../types/Statistic';
@@ -409,8 +409,12 @@ export default class StatisticService {
// User
if (Authorizations.isBasic(loggedUser)) {
if (Authorizations.isSiteAdmin(loggedUser)) {
+ if (filteredRequest.UserID) {
+ filter.userIDs = filteredRequest.UserID.split('|');
+ } else {
// Only for current sites
filter.siteIDs = loggedUser.sitesAdmin;
+ }
} else {
// Only for current user
filter.userIDs = [loggedUser.id];

Build Filter with userID in statistics