added carAuthorization.projectFields instead of hardcoded fields
MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -78,14 +78,10 @@ export default class UserService {
let car: Car;
if (Utils.isComponentActiveFromToken(req.user, TenantComponents.CAR) && carAuthorization.authorized) {
// Get the default Car
- car = await CarStorage.getDefaultUserCar(req.tenant, filteredRequest.UserID, {},
- ['id', 'type', 'licensePlate', 'carCatalog.vehicleMake', 'carCatalog.vehicleModel', 'carCatalog.vehicleModelVersion', 'carCatalog.image', 'carCatalog.batteryCapacityFull', 'carCatalog.fastChargePowerMax', 'converter.powerWatts', 'converter.numberOfPhases', 'default', 'carConnectorData.carConnectorID', 'carConnectorData.carConnectorMeterID']
- );
+ car = await CarStorage.getDefaultUserCar(req.tenant, filteredRequest.UserID, {}, carAuthorization.projectFields);
if (!car) {
// Get the first available car
- car = await CarStorage.getFirstAvailableUserCar(req.tenant, filteredRequest.UserID,
- ['id', 'type', 'licensePlate', 'carCatalog.vehicleMake', 'carCatalog.vehicleModel', 'carCatalog.vehicleModelVersion', 'carCatalog.image', 'carCatalog.batteryCapacityFull', 'carCatalog.fastChargePowerMax', 'converter.powerWatts', 'converter.numberOfPhases', 'default', 'carConnectorData.carConnectorID', 'carConnectorData.carConnectorMeterID']
- );
+ car = await CarStorage.getFirstAvailableUserCar(req.tenant, filteredRequest.UserID, carAuthorization.projectFields);
}
}
let withBillingChecks = true ;

added carAuthorization.projectFields instead of hardcoded fields