Added car in tr in errors
MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -879,6 +879,15 @@ export default class TransactionService {
];
}
}
+ // Check Cars
+ if (Utils.isComponentActiveFromToken(req.user, TenantComponents.CAR)) {
+ if (await Authorizations.canListCars(req.user)) {
+ projectFields = [
+ ...projectFields,
+ 'carCatalog.vehicleMake', 'carCatalog.vehicleModel', 'carCatalog.vehicleModelVersion',
+ ];
+ }
+ }
const filter: any = {};
// Filter
const filteredRequest = TransactionSecurity.filterTransactionsInErrorRequest(req.query);

MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -895,7 +895,7 @@ export default class TransactionStorage {
aggregation.push({
$match: match
});
- // Charging Station?
+ // Charging Station
if (params.withChargingStations ||
(params.errorType && params.errorType.includes(TransactionInErrorType.OVER_CONSUMPTION))) {
// Add Charge Box
@@ -905,11 +905,16 @@ export default class TransactionStorage {
});
DatabaseUtils.pushConvertObjectIDToString(aggregation, 'chargeBox.siteAreaID');
}
- // Add respective users
+ // User
DatabaseUtils.pushUserLookupInAggregation({
tenantID, aggregation: aggregation, asField: 'user', localField: 'userID',
foreignField: '_id', oneToOneCardinality: true, oneToOneCardinalityNotNull: false
});
+ // Car Catalog
+ DatabaseUtils.pushCarCatalogLookupInAggregation({
+ tenantID: Constants.DEFAULT_TENANT, aggregation: aggregation, asField: 'carCatalog', localField: 'carCatalogID',
+ foreignField: '_id', oneToOneCardinality: true
+ });
// Used only in the error type : missing_user
if (params.errorType && params.errorType.includes(TransactionInErrorType.MISSING_USER)) {
// Site Area

Added car in tr in errors