small adjustments car connector data
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"id": "###",
"canRead": true,
"canDelete": true,
- "canUpdate": true
+ "canUpdate": true,
+ "carConnectorData": {
+ "carConnectorName": "string",
+ "carConnectorMeterID": "string"
+ }
}
}
}
]
}
}
+ },
+ "carConnectorData": {
+ "carConnectorName": "string",
+ "carConnectorMeterID": "string"
}
}
}

MODIFY
src/server/rest/v1/service/security/CarSecurity.ts
src/server/rest/v1/service/security/CarSecurity.ts
@@ -41,7 +41,7 @@ export default class CarSecurity {
}
public static filterCarCreateRequest(request: any): HttpCarCreateRequest {
- return {
+ const filteredRequest: HttpCarCreateRequest = {
vin: sanitize(request.vin),
licensePlate: sanitize(request.licensePlate),
carCatalogID: Utils.convertToInt(sanitize(request.carCatalogID)),
@@ -54,13 +54,16 @@ export default class CarSecurity {
numberOfPhases: sanitize(request.converter.numberOfPhases),
type: sanitize(request.converter.type),
powerWatts: sanitize(request.converter.powerWatts)
- },
- carConnectorData: {
+ }
+ };
+ if (Utils.objectHasProperty(request, 'carConnectorData')) {
+ filteredRequest.carConnectorData = {
carConnectorID: sanitize(request.carConnectorData.carConnectorID),
carConnectorMeterID: sanitize(request.carConnectorData.carConnectorMeterID)
- }
};
}
+ return filteredRequest;
+ }
public static filterCarUpdateRequest(request: any): HttpCarUpdateRequest {
const filteredRequest: HttpCarUpdateRequest = {
@@ -76,12 +79,14 @@ export default class CarSecurity {
numberOfPhases: sanitize(request.converter.numberOfPhases),
type: sanitize(request.converter.type),
powerWatts: sanitize(request.converter.powerWatts)
- },
- carConnectorData: {
+ }
+ };
+ if (Utils.objectHasProperty(request, 'carConnectorData')) {
+ filteredRequest.carConnectorData = {
carConnectorID: sanitize(request.carConnectorData.carConnectorID),
carConnectorMeterID: sanitize(request.carConnectorData.carConnectorMeterID)
- }
};
+ }
return filteredRequest;
}

MODIFY
src/storage/mongodb/DatabaseUtils.ts
src/storage/mongodb/DatabaseUtils.ts
@@ -158,7 +158,7 @@ export default class DatabaseUtils {
}
}
- public static pushCollectionLookupInAggregation(collection: string, lookupParams: Partial<DbLookup>, additionalPipeline?: Record<string, any>[]): void {
+ public static pushCollectionLookupInAggregation(collection: string, lookupParams: DbLookup, additionalPipeline?: Record<string, any>[]): void {
// Build Lookup's pipeline
if (!lookupParams.pipelineMatch) {
lookupParams.pipelineMatch = {};

MODIFY
src/types/requests/HttpCarRequest.ts
src/types/requests/HttpCarRequest.ts
@@ -34,9 +34,9 @@ export interface HttpCarCreateRequest {
converter?: CarConverter;
userID: string;
default: boolean;
- carConnectorData: {
+ carConnectorData?: {
carConnectorID: string;
- carConnectorMeterID: string;
+ carConnectorMeterID?: string;
}
}
@@ -50,9 +50,9 @@ export interface HttpCarUpdateRequest {
converter?: CarConverter;
userID: string;
default: boolean;
- carConnectorData: {
+ carConnectorData?: {
carConnectorID: string;
- carConnectorMeterID: string;
+ carConnectorMeterID?: string;
}
}

small adjustments car connector data