Added OCPI 'owner' is Location
MODIFY
src/assets/schemas/common/common.json
src/assets/schemas/common/common.json
},
"tariff-id": {
"type": "string",
- "minLength": 1,
"maxLength": 36,
"sanitize": "mongo",
"nullable": true
},
+ "owner-name": {
+ "type": "string",
+ "maxLength": 100,
+ "sanitize": "mongo"
+ },
"authSubdomain": {
"type": "string",
"pattern": "^[a-z0-9]*$",

MODIFY
src/assets/server/rest/v1/schemas/site/site-create.json
src/assets/server/rest/v1/schemas/site/site-create.json
"tariffID": {
"$ref": "common#/definitions/tariff-id"
},
+ "ownerName": {
+ "$ref": "common#/definitions/owner-name"
+ },
"autoUserSiteAssignment": {
"$ref": "site#/definitions/autoUserSiteAssignment"
},

MODIFY
src/assets/server/rest/v1/schemas/site/site-update.json
src/assets/server/rest/v1/schemas/site/site-update.json
"tariffID": {
"$ref": "common#/definitions/tariff-id"
},
+ "ownerName": {
+ "$ref": "common#/definitions/owner-name"
+ },
"autoUserSiteAssignment": {
"$ref": "site#/definitions/autoUserSiteAssignment"
},

MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -337,7 +337,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
resource: Entity.SITE, action: Action.READ,
attributes: [
'id', 'name', 'companyID', 'company.name', 'autoUserSiteAssignment', 'issuer',
- 'autoUserSiteAssignment', 'distanceMeters', 'public', 'createdOn', 'lastChangedOn', 'tariffID',
+ 'autoUserSiteAssignment', 'distanceMeters', 'public', 'createdOn', 'lastChangedOn', 'tariffID', 'ownerName',
'address.address1', 'address.address2', 'address.postalCode', 'address.city',
'address.department', 'address.region', 'address.country', 'address.coordinates',
'accountData.accountID', 'accountData.platformFeeStrategy.flatFeePerSession',
@@ -2258,7 +2258,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
},
attributes: [
'id', 'name', 'companyID', 'company.name', 'autoUserSiteAssignment', 'issuer',
- 'autoUserSiteAssignment', 'distanceMeters', 'public', 'createdOn', 'lastChangedOn', 'tariffID',
+ 'autoUserSiteAssignment', 'distanceMeters', 'public', 'createdOn', 'lastChangedOn', 'tariffID', 'ownerName',
'address.address1', 'address.address2', 'address.postalCode', 'address.city',
'address.department', 'address.region', 'address.country', 'address.coordinates'
],

MODIFY
src/server/ocpi/service/OCPIUtilsService.ts
src/server/ocpi/service/OCPIUtilsService.ts
@@ -71,7 +71,7 @@ export default class OCPIUtilsService {
const sites = await SiteStorage.getSites(tenant,
{ issuer: true, public: true },
limit === 0 ? Constants.DB_PARAMS_MAX_LIMIT : { limit, skip },
- ['id', 'name', 'address', 'lastChangedOn', 'createdOn']);
+ ['id', 'name', 'address', 'ownerName', 'lastChangedOn', 'createdOn']);
// Convert Sites to Locations
for (const site of sites.result) {
ocpiLocationsResult.result.push(
@@ -135,6 +135,9 @@ export default class OCPIUtilsService {
evses: withChargingStations ?
await OCPIUtilsService.getCpoEvsesFromSite(tenant, site.id, options, null, Constants.DB_PARAMS_MAX_LIMIT, settings) : [],
operator: OCPIUtilsService.getOperatorBusinessDetails(settings) ?? { name: 'Undefined' },
+ owner: {
+ name: site.ownerName ?? 'Undefined',
+ },
last_updated: site.lastChangedOn ? site.lastChangedOn : site.createdOn,
opening_times: this.buildCpoOpeningTimes(tenant, site)
};

MODIFY
src/server/rest/v1/service/SiteService.ts
src/server/rest/v1/service/SiteService.ts
@@ -362,6 +362,9 @@ export default class SiteService {
if (Utils.objectHasProperty(filteredRequest, 'tariffID')) {
site.tariffID = filteredRequest.tariffID;
}
+ if (Utils.objectHasProperty(filteredRequest, 'ownerName')) {
+ site.ownerName = filteredRequest.ownerName;
+ }
}
if (Utils.objectHasProperty(filteredRequest, 'autoUserSiteAssignment')) {
site.autoUserSiteAssignment = filteredRequest.autoUserSiteAssignment;

MODIFY
src/storage/mongodb/SiteStorage.ts
src/storage/mongodb/SiteStorage.ts
@@ -257,6 +257,7 @@ export default class SiteStorage {
autoUserSiteAssignment: Utils.convertToBoolean(siteToSave.autoUserSiteAssignment),
name: siteToSave.name,
tariffID: siteToSave.tariffID,
+ ownerName: siteToSave.ownerName,
};
if (siteToSave.address) {
siteMDB.address = {

MODIFY
src/types/Site.ts
src/types/Site.ts
@@ -24,6 +24,7 @@ export default interface Site extends CreatedUpdatedProps, SiteAuthorizationActi
public?: boolean;
openingTimes?: OpeningTimes;
tariffID?: string;
+ ownerName?: string;
accountData?: BillingAccountData;
}

Added OCPI 'owner' is Location