Refactored pull locations
MODIFY
src/client/ocpi/EmspOCPIClient.ts
src/client/ocpi/EmspOCPIClient.ts
@@ -127,10 +127,10 @@ export default class EmspOCPIClient extends OCPIClient {
if (partial) {
// Take the last day
const momentFrom = moment().utc().subtract(1, 'days').startOf('day');
- locationsUrl = `${locationsUrl}?date_from=${momentFrom.format()}&limit=5`;
+ locationsUrl = `${locationsUrl}?date_from=${momentFrom.format()}&limit=50`;
} else {
// Take them all
- locationsUrl = `${locationsUrl}?limit=5`;
+ locationsUrl = `${locationsUrl}?limit=50`;
}
const company = await OCPIUtils.checkAndGetEMSPCompany(this.tenant, this.ocpiEndpoint);
const sites = await SiteStorage.getSites(this.tenant,
@@ -150,12 +150,19 @@ export default class EmspOCPIClient extends OCPIClient {
// Cannot process locations in parallel (uniqueness is on site name) -> leads to dups
for (const location of locations) {
try {
- await OCPIUtils.processEMSPLocation(this.tenant, location, company, sites.result);
+ // Get the Site
+ const foundSite = sites.result.find((existingSite) => existingSite.name === location.operator.name);
+ // Process the Location
+ const site = await OCPIUtils.processEMSPLocation(this.tenant, location, company, foundSite, location.operator.name);
+ // Push the Site then it can be retrieve in the next round
+ if (!foundSite && site) {
+ sites.result.push(site);
+ }
result.success++;
} catch (error) {
result.failure++;
result.logs.push(
- `Failed to update Location '${location.name}': ${error.message}`
+ `Failed to update Location '${location.name}': ${error.message as string}`
);
}
}

MODIFY
src/server/ocpi/OCPIUtils.ts
src/server/ocpi/OCPIUtils.ts
import ChargingStation, { Connector } from '../../types/ChargingStation';
+import { OCPIEvse, OCPIEvseStatus } from '../../types/ocpi/OCPIEvse';
import { OCPIToken, OCPITokenType } from '../../types/ocpi/OCPIToken';
import AppError from '../../exception/AppError';
@@ -9,7 +10,6 @@ import CompanyStorage from '../../storage/mongodb/CompanyStorage';
import Constants from '../../utils/Constants';
import Logging from '../../utils/Logging';
import OCPIEndpoint from '../../types/ocpi/OCPIEndpoint';
-import { OCPIEvseStatus } from '../../types/ocpi/OCPIEvse';
import { OCPILocation } from '../../types/ocpi/OCPILocation';
import { OCPIResponse } from '../../types/ocpi/OCPIResponse';
import { OCPIStatusCode } from '../../types/ocpi/OCPIStatusCode';
@@ -170,19 +170,56 @@ export default class OCPIUtils {
return company;
}
- public static async processEMSPLocation(tenant: Tenant, location: OCPILocation, company: Company, existingSites: Site[],
- countryCode?: string, partyID?: string): Promise<void> {
+ public static async processEMSPLocation(tenant: Tenant, location: OCPILocation, company: Company, site: Site, siteName: string): Promise<Site> {
+ // Remove EVSEs from location
+ location = Utils.cloneObject(location);
+ const evses = location.evses;
+ delete location.evses;
// Handle Site
- let site: Site;
- const siteName = location.operator?.name ?? OCPIUtils.buildOperatorName(countryCode, partyID);
- site = existingSites.find((existingSite) => existingSite.name === siteName);
- if (!site) {
+ site = await OCPIUtils.processEMSPLocationSite(tenant, location, company, site, siteName);
+ // Handle Site Area
+ const siteArea = await OCPIUtils.processEMSPLocationSiteArea(tenant, location, site);
+ // Handle EVSEs
+ if (!Utils.isEmptyArray(evses)) {
+ for (const evse of evses) {
+ try {
+ await OCPIUtils.processEMSPLocationChargingStation(tenant, evse, location, site, siteArea);
+ } catch (error) {
+ await Logging.logError({
+ tenantID: tenant.id,
+ action: ServerAction.OCPI_PULL_LOCATIONS,
+ module: MODULE_NAME, method: 'processEMSPLocation',
+ message: `Error while processing the EVSE UID '${evse.uid}' (ID '${evse.evse_id}') in Location '${location.name}'`,
+ detailedMessages: { error: error.stack, evse, location, site, siteArea }
+ });
+ }
+ }
+ }
+ return site;
+ }
+
+ private static async processEMSPLocationSite(tenant: Tenant, location: OCPILocation, company: Company, site: Site, siteName: string): Promise<Site> {
// Create Site
+ if (!site) {
site = {
name: siteName,
createdOn: new Date(),
companyID: company.id,
issuer: false,
+ ocpiData: location,
+ address: {
+ address1: location.address,
+ postalCode: location.postal_code,
+ city: location.city,
+ country: location.country,
+ coordinates: []
+ }
+ } as Site;
+ } else {
+ site = {
+ ...site,
+ lastChangedOn: new Date(),
+ ocpiData: location,
address: {
address1: location.address,
postalCode: location.postal_code,
@@ -191,29 +228,47 @@ export default class OCPIUtils {
coordinates: []
}
} as Site;
+ }
if (location.coordinates?.latitude && location.coordinates?.longitude) {
site.address.coordinates = [
Utils.convertToFloat(location.coordinates.longitude),
Utils.convertToFloat(location.coordinates.latitude)
];
}
- site.id = await SiteStorage.saveSite(tenant, site, false);
- // Push the Site then it can be retrieve in the next round
- existingSites.push(site);
+ // Update Site
+ site.id = await SiteStorage.saveSite(tenant, site);
+ await SiteStorage.saveSiteOcpiData(tenant, site.id, site.ocpiData);
+ return site;
}
- const locationName = site.name + Constants.OCPI_SEPARATOR + location.id;
- // Handle Site Area
+
+ private static async processEMSPLocationSiteArea(tenant: Tenant, location: OCPILocation, site: Site): Promise<SiteArea> {
+ const siteAreaName = `${site.name}${Constants.OCPI_SEPARATOR}${location.id}`;
const siteAreas = await SiteAreaStorage.getSiteAreas(tenant,
- { siteIDs: [site.id], name: locationName, issuer: false, withSite: true },
+ { siteIDs: [site.id], name: siteAreaName, issuer: false, withSite: true },
Constants.DB_PARAMS_SINGLE_RECORD);
let siteArea = !Utils.isEmptyArray(siteAreas.result) ? siteAreas.result[0] : null;
- if (!siteArea) {
// Create Site Area
+ if (!siteArea) {
siteArea = {
- name: locationName,
+ name: siteAreaName,
createdOn: new Date(),
siteID: site.id,
issuer: false,
+ ocpiData: location,
+ address: {
+ address1: location.address,
+ address2: location.name,
+ postalCode: location.postal_code,
+ city: location.city,
+ country: location.country,
+ coordinates: []
+ }
+ } as SiteArea;
+ } else {
+ siteArea = {
+ ...siteArea,
+ lastChangedOn: new Date(),
+ ocpiData: location,
address: {
address1: location.address,
address2: location.name,
@@ -223,16 +278,20 @@ export default class OCPIUtils {
coordinates: []
}
} as SiteArea;
+ }
if (location.coordinates?.latitude && location.coordinates?.longitude) {
siteArea.address.coordinates = [
Utils.convertToFloat(location.coordinates.longitude),
Utils.convertToFloat(location.coordinates.latitude)
];
}
- siteArea.id = await SiteAreaStorage.saveSiteArea(tenant, siteArea, false);
+ // Update Site Area
+ siteArea.id = await SiteAreaStorage.saveSiteArea(tenant, siteArea);
+ await SiteAreaStorage.saveSiteAreaOcpiData(tenant, siteArea.id, siteArea.ocpiData);
+ return siteArea;
}
- if (!Utils.isEmptyArray(location.evses)) {
- for (const evse of location.evses) {
+
+ private static async processEMSPLocationChargingStation(tenant: Tenant, evse: OCPIEvse, location: OCPILocation, site: Site, siteArea: SiteArea): Promise<void> {
if (!evse.uid) {
throw new BackendError({
action: ServerAction.OCPI_PULL_LOCATIONS,
@@ -241,12 +300,11 @@ export default class OCPIUtils {
detailedMessages: { evse, location }
});
}
- if (evse.status === OCPIEvseStatus.REMOVED) {
// Get existing charging station
const currentChargingStation = await ChargingStationStorage.getChargingStationByOcpiLocationUid(
- tenant, location.id, evse.uid, ['id']
- );
- if (currentChargingStation) {
+ tenant, location.id, evse.uid);
+ // Delete Charging Station
+ if (currentChargingStation && evse.status === OCPIEvseStatus.REMOVED) {
await ChargingStationStorage.deleteChargingStation(tenant, currentChargingStation.id);
await Logging.logDebug({
tenantID: tenant.id,
@@ -255,24 +313,18 @@ export default class OCPIUtils {
module: MODULE_NAME, method: 'processLocation',
detailedMessages: { evse, location }
});
- }
- continue;
- }
// Update Charging Station
- const chargingStation = OCPIUtilsService.convertEvseToChargingStation(evse, location);
- chargingStation.companyID = siteArea.site?.companyID;
- chargingStation.siteID = siteArea.siteID;
- chargingStation.siteAreaID = siteArea.id;
+ } else {
+ const chargingStation = OCPIUtilsService.convertEvseToChargingStation(currentChargingStation, evse, location, site, siteArea);
await ChargingStationStorage.saveChargingStation(tenant, chargingStation);
await ChargingStationStorage.saveChargingStationOcpiData(tenant, chargingStation.id, chargingStation.ocpiData);
await Logging.logDebug({
tenantID: tenant.id,
action: ServerAction.OCPI_PULL_LOCATIONS,
- message: `Updated Charging Station ID '${evse.evse_id}' in Location '${location.name}'`,
+ message: `${currentChargingStation ? 'Updated' : 'Created'} Charging Station ID '${chargingStation.id}' in Location '${location.name}' with ID '${location.id}'`,
module: MODULE_NAME, method: 'processLocation',
detailedMessages: location
});
}
}
}
-}

MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIUtilsService.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIUtilsService.ts
@@ -56,15 +56,40 @@ export default class OCPIUtilsService {
response.status_code === 1000;
}
- public static convertEvseToChargingStation(evse: Partial<OCPIEvse>, location: OCPILocation): ChargingStation {
- const chargingStation = {
+ public static convertEvseToChargingStation(chargingStation: ChargingStation, evse: OCPIEvse,
+ location: OCPILocation, site: Site, siteArea: SiteArea): ChargingStation {
+ if (!evse.evse_id) {
+ throw new BackendError({
+ action: ServerAction.OCPI_ENDPOINT,
+ message: 'Cannot find Charging Station EVSE ID',
+ module: MODULE_NAME, method: 'convertEvseToChargingStation',
+ detailedMessages: { evse, location }
+ });
+ }
+ if (!chargingStation) {
+ chargingStation = {
+ id: evse.evse_id,
+ createdOn: new Date(),
maximumPower: 0,
issuer: false,
connectors: [],
+ companyID: site.companyID,
+ siteID: site.id,
+ siteAreaID: siteArea.id,
ocpiData: {
evses: [evse]
}
} as ChargingStation;
+ } else {
+ chargingStation = {
+ ...chargingStation,
+ lastChangedOn: new Date(),
+ connectors: [],
+ ocpiData: {
+ evses: [evse]
+ }
+ } as ChargingStation;
+ }
// Set the location ID
evse.location_id = location.id;
// Coordinates
@@ -97,17 +122,6 @@ export default class OCPIUtilsService {
connectorId++;
}
}
- // Build ID
- chargingStation.id = evse.evse_id;
- // TODO: Handle missing evse_id in eMSP (tokens, sessions, cdr): Need to identify the use cases so force it to crash here
- if (!chargingStation.id) {
- throw new BackendError({
- action: ServerAction.OCPI_ENDPOINT,
- message: 'Cannot find Charging Station EVSE ID',
- module: MODULE_NAME, method: 'convertEvseToChargingStation',
- detailedMessages: { evse, location }
- });
- }
return chargingStation;
}
@@ -196,25 +210,6 @@ export default class OCPIUtilsService {
};
}
- public static convertEMSPSiteArea2Location(siteArea: SiteArea, settings: OcpiSetting): OCPILocation {
- // Becareful: Partial Location
- return {
- id: siteArea.id.split('*')[2],
- type: OCPILocationType.UNKNOWN,
- name: siteArea.name,
- address: siteArea.address?.address1,
- city: siteArea.address?.city,
- postal_code: siteArea.address?.postalCode,
- country: siteArea.address?.country,
- coordinates: {
- longitude: siteArea.address?.coordinates[0].toString(),
- latitude: siteArea.address?.coordinates[1].toString()
- },
- operator: OCPIUtilsService.getOperatorBusinessDetails(settings) ?? { name: 'Undefined' },
- last_updated: siteArea.lastChangedOn ? siteArea.lastChangedOn : siteArea.createdOn,
- };
- }
-
// TODO: Implement the Opening Hours in the Site and send it to OCPI
public static buildOpeningTimes(tenant: Tenant, site: Site): OCPIOpeningTimes {
switch (tenant?.id) {

MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/emsp/EMSPLocationsEndpoint.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/emsp/EMSPLocationsEndpoint.ts
@@ -87,20 +87,20 @@ export default class EMSPLocationsEndpoint extends AbstractEndpoint {
detailedMessages: { countryCode, partyID, locationID, evseUID, chargingStation }
});
}
- // Rebuild Location
- const location = OCPIUtilsService.convertEMSPSiteArea2Location(chargingStation.siteArea, ocpiClient.getSettings());
- // Get the EVSE
- const chargingStationEvse = chargingStation.ocpiData.evses.find((evse) => evse.uid === evseUID);
- if (!chargingStationEvse) {
- throw new AppError({
- action: ServerAction.OCPI_PATCH_LOCATION,
- module: MODULE_NAME, method: 'patchLocationRequest',
- errorCode: StatusCodes.NOT_FOUND,
- message: `Unknown EVSE UID '${evseUID}'`,
- ocpiError: OCPIStatusCode.CODE_2003_UNKNOWN_LOCATION_ERROR,
- detailedMessages: { countryCode, partyID, locationID, evseUID, location }
- });
- }
+ // // Rebuild Location
+ // const location = OCPIUtilsService.convertEMSPSiteArea2Location(chargingStation.siteArea, ocpiClient.getSettings());
+ // // Get the EVSE
+ // const chargingStationEvse = chargingStation.ocpiData.evses.find((evse) => evse.uid === evseUID);
+ // if (!chargingStationEvse) {
+ // throw new AppError({
+ // action: ServerAction.OCPI_PATCH_LOCATION,
+ // module: MODULE_NAME, method: 'patchLocationRequest',
+ // errorCode: StatusCodes.NOT_FOUND,
+ // message: `Unknown EVSE UID '${evseUID}'`,
+ // ocpiError: OCPIStatusCode.CODE_2003_UNKNOWN_LOCATION_ERROR,
+ // detailedMessages: { countryCode, partyID, locationID, evseUID, location }
+ // });
+ // }
if (connectorID) {
const evseConnector = req.body as OCPIConnector;
// const foundEvseConnector = foundEvse.connectors.find((evseConnector) => evseConnector.id === connectorID);
@@ -119,7 +119,7 @@ export default class EMSPLocationsEndpoint extends AbstractEndpoint {
} else {
const evse = req.body as OCPIEvse;
// Patch Evse
- await this.patchEvse(tenant, chargingStation, chargingStationEvse, location);
+ // await this.patchEvse(tenant, chargingStation, chargingStationEvse, location);
}
// Handle Location
} else {
@@ -189,11 +189,14 @@ export default class EMSPLocationsEndpoint extends AbstractEndpoint {
await this.updateEvse(tenant, foundEvse, location);
}
} else {
- // Update Location
+ // Get the Orgs
const company = await OCPIUtils.checkAndGetEMSPCompany(tenant, ocpiEndpoint);
const siteName = OCPIUtils.buildOperatorName(countryCode, partyID);
const sites = await SiteStorage.getSites(tenant, { companyIDs: [company.id], name: siteName }, Constants.DB_PARAMS_SINGLE_RECORD);
- await OCPIUtils.processEMSPLocation(tenant, location, company, sites.result, countryCode, partyID);
+ // Get the Site
+ const foundSite = sites.result.find((existingSite) => existingSite.name === siteName);
+ // Update Location
+ await OCPIUtils.processEMSPLocation(tenant, location, company, foundSite, siteName);
}
return OCPIUtils.success();
}
@@ -232,15 +235,15 @@ export default class EMSPLocationsEndpoint extends AbstractEndpoint {
foundChargingStationEvse.last_updated = evse.last_updated;
}
// Rebuild the charging station
- const patchedChargingStation = OCPIUtilsService.convertEvseToChargingStation(evse, location);
+ // const patchedChargingStation = OCPIUtilsService.convertEvseToChargingStation(evse, location);
// Report updates
- if (patchedChargingStation.coordinates) {
- chargingStation.coordinates = patchedChargingStation.coordinates;
- }
- if (!Utils.isEmptyArray(patchedChargingStation.connectors)) {
- chargingStation.connectors = patchedChargingStation.connectors;
- chargingStation.maximumPower = patchedChargingStation.maximumPower;
- }
+ // if (patchedChargingStation.coordinates) {
+ // chargingStation.coordinates = patchedChargingStation.coordinates;
+ // }
+ // if (!Utils.isEmptyArray(patchedChargingStation.connectors)) {
+ // chargingStation.connectors = patchedChargingStation.connectors;
+ // chargingStation.maximumPower = patchedChargingStation.maximumPower;
+ // }
await ChargingStationStorage.saveChargingStation(tenant, chargingStation);
}
@@ -289,8 +292,8 @@ export default class EMSPLocationsEndpoint extends AbstractEndpoint {
}
} else {
// Create/Update
- const chargingStation = OCPIUtilsService.convertEvseToChargingStation(evse, location);
- await ChargingStationStorage.saveChargingStation(tenant, chargingStation);
+ // const chargingStation = OCPIUtilsService.convertEvseToChargingStation(evse, location);
+ // await ChargingStationStorage.saveChargingStation(tenant, chargingStation);
await Logging.logDebug({
tenantID: tenant.id,
action: ServerAction.OCPI_PATCH_LOCATION,

MODIFY
src/server/rest/v1/service/SiteAreaService.ts
src/server/rest/v1/service/SiteAreaService.ts
@@ -294,7 +294,7 @@ export default class SiteAreaService {
}
}
// Save
- siteArea.id = await SiteAreaStorage.saveSiteArea(req.tenant, siteArea, true);
+ siteArea.id = await SiteAreaStorage.saveSiteArea(req.tenant, siteArea, Utils.objectHasProperty(filteredRequest, 'image'));
await Logging.logInfo({
tenantID: req.user.tenantID,
user: req.user, module: MODULE_NAME, method: 'handleCreateSiteArea',

MODIFY
src/server/rest/v1/service/SiteService.ts
src/server/rest/v1/service/SiteService.ts
@@ -372,7 +372,7 @@ export default class SiteService {
}
}
// Save
- site.id = await SiteStorage.saveSite(req.tenant, site);
+ site.id = await SiteStorage.saveSite(req.tenant, site, Utils.objectHasProperty(filteredRequest, 'image'));
await Logging.logInfo({
tenantID: req.user.tenantID,
user: req.user, module: MODULE_NAME, method: 'handleCreateSite',
@@ -439,7 +439,7 @@ export default class SiteService {
site.lastChangedBy = { 'id': req.user.id };
site.lastChangedOn = new Date();
// Save
- await SiteStorage.saveSite(req.tenant, site, Utils.objectHasProperty(filteredRequest, 'image') ? true : false);
+ await SiteStorage.saveSite(req.tenant, site, Utils.objectHasProperty(filteredRequest, 'image'));
// Update all refs
void SiteStorage.updateEntitiesWithOrganizationIDs(req.tenant, site.companyID, filteredRequest.id);
await Logging.logInfo({

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -637,8 +637,7 @@ export default class ChargingStationStorage {
await Logging.traceDatabaseRequestEnd(tenant, MODULE_NAME, 'saveChargingStationRuntimeData', startTime, runtimeData);
}
- public static async saveChargingStationOcpiData(tenant: Tenant, id: string,
- ocpiData: ChargingStationOcpiData): Promise<void> {
+ public static async saveChargingStationOcpiData(tenant: Tenant, id: string, ocpiData: ChargingStationOcpiData): Promise<void> {
const startTime = Logging.traceDatabaseRequestStart();
DatabaseUtils.checkTenantObject(tenant);
// Modify document

MODIFY
src/storage/mongodb/SiteAreaStorage.ts
src/storage/mongodb/SiteAreaStorage.ts
@@ -8,6 +8,7 @@ import { DataResult } from '../../types/DataResult';
import DatabaseUtils from './DatabaseUtils';
import DbParams from '../../types/database/DbParams';
import Logging from '../../utils/Logging';
+import { OCPILocation } from '../../types/ocpi/OCPILocation';
import { ObjectId } from 'mongodb';
import SiteArea from '../../types/SiteArea';
import Tenant from '../../types/Tenant';
@@ -144,6 +145,21 @@ export default class SiteAreaStorage {
return siteAreaMDB._id.toString();
}
+ public static async saveSiteAreaOcpiData(tenant: Tenant, id: string, ocpiData: OCPILocation): Promise<void> {
+ const startTime = Logging.traceDatabaseRequestStart();
+ DatabaseUtils.checkTenantObject(tenant);
+ // Modify document
+ await global.database.getCollection<any>(tenant.id, 'siteareas').findOneAndUpdate(
+ { '_id': DatabaseUtils.convertToObjectID(id) },
+ {
+ $set: {
+ ocpiData
+ }
+ },
+ { upsert: false });
+ await Logging.traceDatabaseRequestEnd(tenant, MODULE_NAME, 'saveSiteAreaOcpiData', startTime, ocpiData);
+ }
+
public static async getSiteAreas(tenant: Tenant,
params: {
siteAreaIDs?: string[]; search?: string; siteIDs?: string[]; companyIDs?: string[]; withSite?: boolean; issuer?: boolean; name?: string;

MODIFY
src/storage/mongodb/SiteStorage.ts
src/storage/mongodb/SiteStorage.ts
@@ -7,6 +7,7 @@ import { DataResult } from '../../types/DataResult';
import DatabaseUtils from './DatabaseUtils';
import DbParams from '../../types/database/DbParams';
import Logging from '../../utils/Logging';
+import { OCPILocation } from '../../types/ocpi/OCPILocation';
import { ObjectId } from 'mongodb';
import Site from '../../types/Site';
import SiteAreaStorage from './SiteAreaStorage';
@@ -238,7 +239,7 @@ export default class SiteStorage {
await Logging.traceDatabaseRequestEnd(tenant, MODULE_NAME, 'updateSiteUserAdmin', startTime, { siteID, userID, siteAdmin });
}
- public static async saveSite(tenant: Tenant, siteToSave: Site, saveImage = true): Promise<string> {
+ public static async saveSite(tenant: Tenant, siteToSave: Site, saveImage = false): Promise<string> {
const startTime = Logging.traceDatabaseRequestStart();
DatabaseUtils.checkTenantObject(tenant);
const siteFilter: any = {};
@@ -286,6 +287,21 @@ export default class SiteStorage {
return siteFilter._id.toString();
}
+ public static async saveSiteOcpiData(tenant: Tenant, id: string, ocpiData: OCPILocation): Promise<void> {
+ const startTime = Logging.traceDatabaseRequestStart();
+ DatabaseUtils.checkTenantObject(tenant);
+ // Modify document
+ await global.database.getCollection<any>(tenant.id, 'sites').findOneAndUpdate(
+ { '_id': DatabaseUtils.convertToObjectID(id) },
+ {
+ $set: {
+ ocpiData
+ }
+ },
+ { upsert: false });
+ await Logging.traceDatabaseRequestEnd(tenant, MODULE_NAME, 'saveSiteOcpiData', startTime, ocpiData);
+ }
+
public static async saveSiteImage(tenant: Tenant, siteID: string, siteImageToSave: string): Promise<void> {
const startTime = Logging.traceDatabaseRequestStart();
DatabaseUtils.checkTenantObject(tenant);

MODIFY
src/types/Site.ts
src/types/Site.ts
@@ -2,6 +2,7 @@ import Address from './Address';
import Company from './Company';
import ConnectorStats from './ConnectorStats';
import CreatedUpdatedProps from './CreatedUpdatedProps';
+import { OCPILocation } from './ocpi/OCPILocation';
import { OpeningTimes } from './OpeningTimes';
import SiteArea from './SiteArea';
import { SiteAuthorizationActions } from './Authorization';
@@ -21,6 +22,7 @@ export default interface Site extends CreatedUpdatedProps, SiteAuthorizationActi
public?: boolean;
openingTimes?: OpeningTimes;
tariffID?: string;
+ ocpiData?: OCPILocation;
}
export interface SiteUser {

MODIFY
src/types/SiteArea.ts
src/types/SiteArea.ts
@@ -4,6 +4,7 @@ import Address from './Address';
import ConnectorStats from './ConnectorStats';
import Consumption from './Consumption';
import CreatedUpdatedProps from './CreatedUpdatedProps';
+import { OCPILocation } from './ocpi/OCPILocation';
import { OpeningTimes } from './OpeningTimes';
import Site from '../types/Site';
import { SiteAreaAuthorizationActions } from './Authorization';
@@ -42,4 +43,5 @@ export default interface SiteArea extends CreatedUpdatedProps, SiteAreaAuthoriza
distanceMeters?: number;
openingTimes?: OpeningTimes;
tariffID?: string;
+ ocpiData?: OCPILocation;
}

Refactored pull locations