Don's use Search to find site / site area
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
@@ -112,7 +112,7 @@ export default class EMSPLocationsEndpoint extends AbstractEndpoint {
const siteName = OCPIUtils.buildOperatorName(countryCode, partyId);
const ocpiClient = await OCPIClientFactory.getEmspOcpiClient(tenant, ocpiEndpoint);
const company = await ocpiClient.checkAndGetCompany();
- const sites = await SiteStorage.getSites(tenant.id, { companyIDs: [company.id], search: siteName }, Constants.DB_PARAMS_SINGLE_RECORD);
+ const sites = await SiteStorage.getSites(tenant.id, { companyIDs: [company.id], name: siteName }, Constants.DB_PARAMS_SINGLE_RECORD);
if (evseUid && connectorId) {
await this.updateConnector(tenant, locationId, evseUid, connectorId, req.body);
} else if (evseUid) {

MODIFY
src/storage/mongodb/SiteStorage.ts
src/storage/mongodb/SiteStorage.ts
@@ -306,7 +306,7 @@ export default class SiteStorage {
public static async getSites(tenantID: string,
params: {
search?: string; companyIDs?: string[]; withAutoUserAssignment?: boolean; siteIDs?: string[];
- userID?: string; excludeSitesOfUserID?: boolean; issuer?: boolean; onlyPublicSite?: boolean;
+ userID?: string; excludeSitesOfUserID?: boolean; issuer?: boolean; onlyPublicSite?: boolean; name?: string;
withAvailableChargingStations?: boolean; withOnlyChargingStations?: boolean; withCompany?: boolean;
locCoordinates?: number[]; locMaxDistanceMeters?: number; withImage?: boolean;
} = {},
@@ -344,6 +344,10 @@ export default class SiteStorage {
{ 'name': { $regex: params.search, $options: 'i' } }
];
}
+ // Site Name
+ if (params.name) {
+ filters.name = params.name;
+ }
// Site
if (!Utils.isEmptyArray(params.siteIDs)) {
filters._id = {

Don's use Search to find site / site area