Put OCPI location in Site and Site Area
MODIFY
src/server/ocpi/OCPIUtils.ts
src/server/ocpi/OCPIUtils.ts
@@ -207,7 +207,7 @@ export default class OCPIUtils {
createdOn: new Date(),
companyID: company.id,
issuer: false,
- ocpiData: location,
+ ocpiData: { location },
address: {
address1: location.address,
postalCode: location.postal_code,
@@ -220,7 +220,7 @@ export default class OCPIUtils {
site = {
...site,
lastChangedOn: new Date(),
- ocpiData: location,
+ ocpiData: { location },
address: {
address1: location.address,
postalCode: location.postal_code,
@@ -255,7 +255,7 @@ export default class OCPIUtils {
createdOn: new Date(),
siteID: site.id,
issuer: false,
- ocpiData: location,
+ ocpiData: { location },
address: {
address1: location.address,
address2: location.name,
@@ -269,7 +269,7 @@ export default class OCPIUtils {
siteArea = {
...siteArea,
lastChangedOn: new Date(),
- ocpiData: location,
+ ocpiData: { location },
address: {
address1: location.address,
address2: location.name,

MODIFY
src/storage/mongodb/SiteAreaStorage.ts
src/storage/mongodb/SiteAreaStorage.ts
+import SiteArea, { SiteAreaOcpiData } from '../../types/SiteArea';
import global, { DatabaseCount, FilterParams, Image } from '../../types/GlobalType';
import AssetStorage from './AssetStorage';
@@ -10,7 +11,6 @@ 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';
import TransactionStorage from './TransactionStorage';
import Utils from '../../utils/Utils';
@@ -145,7 +145,7 @@ export default class SiteAreaStorage {
return siteAreaMDB._id.toString();
}
- public static async saveSiteAreaOcpiData(tenant: Tenant, id: string, ocpiData: OCPILocation): Promise<void> {
+ public static async saveSiteAreaOcpiData(tenant: Tenant, id: string, ocpiData: SiteAreaOcpiData): Promise<void> {
const startTime = Logging.traceDatabaseRequestStart();
DatabaseUtils.checkTenantObject(tenant);
// Modify document

MODIFY
src/storage/mongodb/SiteStorage.ts
src/storage/mongodb/SiteStorage.ts
+import Site, { SiteOcpiData } from '../../types/Site';
import global, { DatabaseCount, FilterParams, Image } from '../../types/GlobalType';
import AssetStorage from './AssetStorage';
@@ -9,7 +10,6 @@ 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';
import Tenant from '../../types/Tenant';
import TransactionStorage from './TransactionStorage';
@@ -287,7 +287,7 @@ export default class SiteStorage {
return siteFilter._id.toString();
}
- public static async saveSiteOcpiData(tenant: Tenant, id: string, ocpiData: OCPILocation): Promise<void> {
+ public static async saveSiteOcpiData(tenant: Tenant, id: string, ocpiData: SiteOcpiData): Promise<void> {
const startTime = Logging.traceDatabaseRequestStart();
DatabaseUtils.checkTenantObject(tenant);
// Modify document

MODIFY
src/types/Site.ts
src/types/Site.ts
@@ -22,7 +22,7 @@ export default interface Site extends CreatedUpdatedProps, SiteAuthorizationActi
public?: boolean;
openingTimes?: OpeningTimes;
tariffID?: string;
- ocpiData?: OCPILocation;
+ ocpiData?: SiteOcpiData;
}
export interface SiteUser {
@@ -33,3 +33,6 @@ export interface SiteUser {
siteOwner: boolean;
}
+export interface SiteOcpiData {
+ location: OCPILocation;
+}

MODIFY
src/types/SiteArea.ts
src/types/SiteArea.ts
@@ -43,5 +43,9 @@ export default interface SiteArea extends CreatedUpdatedProps, SiteAreaAuthoriza
distanceMeters?: number;
openingTimes?: OpeningTimes;
tariffID?: string;
- ocpiData?: OCPILocation;
+ ocpiData?: SiteAreaOcpiData;
+}
+
+export interface SiteAreaOcpiData {
+ location: OCPILocation;
}

Put OCPI location in Site and Site Area