Save asset connection settings
MODIFY
src/integration/smart-charging/sap-smart-charging
src/integration/smart-charging/sap-smart-charging
-Subproject commit 463263fcb71b048eb0132f8f36db8d2d01b621bf
+Subproject commit 879f094b38825db4e1ef871cdbbf052b2c5ecd9b

MODIFY
src/server/rest/service/security/SettingSecurity.ts
src/server/rest/service/security/SettingSecurity.ts
-import { AnalyticsSettingsType, BillingSettingsType, ConcurRefundSetting, OcpiBusinessDetails, OcpiSetting, PricingSettingsType, RefundSettingsType, RoamingSettingsType, SettingDB, SettingDBContent, SettingLink, SimplePricingSetting, SmartChargingSettingsType } from '../../../../types/Setting';
-import { HttpSettingRequest, HttpSettingsRequest } from '../../../../types/requests/HttpSettingRequest';
-
+import sanitize from 'mongo-sanitize';
import Authorizations from '../../../../authorization/Authorizations';
+import { HttpSettingRequest, HttpSettingsRequest } from '../../../../types/requests/HttpSettingRequest';
+import { AnalyticsSettingsType, AssetConnectionSetting, AssetSettingsType, BillingSettingsType, ConcurRefundSetting, OcpiBusinessDetails, OcpiSetting, PricingSettingsType, RefundSettingsType, RoamingSettingsType, SettingDB, SettingDBContent, SettingLink, SimplePricingSetting, SmartChargingSettingsType } from '../../../../types/Setting';
import TenantComponents from '../../../../types/TenantComponents';
import UserToken from '../../../../types/UserToken';
import Utils from '../../../../utils/Utils';
import UtilsSecurity from './UtilsSecurity';
-import sanitize from 'mongo-sanitize';
+
export default class SettingSecurity {
@@ -154,6 +154,11 @@ export default class SettingSecurity {
password: sanitize(request.content.sapSmartCharging.password),
};
break;
+ case AssetSettingsType.ASSET:
+ settings.content.asset = {
+ connections: request.content.asset.connections
+ };
+ break;
}
}
return settings;

MODIFY
src/types/Setting.ts
src/types/Setting.ts
@@ -30,7 +30,7 @@ export interface SettingDBContent {
links?: SettingLink[];
concur?: ConcurRefundSetting;
sapSmartCharging?: SapSmartChargingSetting;
- asset?: AssetConnectionSetting;
+ asset?: AssetSetting;
}
export enum PricingSettingsType {
@@ -204,7 +204,7 @@ export enum BillingContentType {
export interface AssetSettings extends Setting {
identifier: TenantComponents.ASSET;
type: AssetSettingsType;
- asset: AssetSetting;
+ asset?: AssetSetting;
}
export enum AssetSettingsType {
@@ -216,11 +216,12 @@ export interface AssetSetting {
}
export interface AssetConnectionSetting {
+ id: string;
name: string;
description: string;
url: string;
type: AssetConnectionType;
- connection: AssetSchneiderConnectionType;
+ connection?: AssetSchneiderConnectionType;
}
export enum AssetConnectionType {

MODIFY
src/types/Tenant.ts
src/types/Tenant.ts
@@ -39,6 +39,7 @@ export default interface Tenant extends CreatedUpdatedProps {
};
asset?: {
active: boolean;
+ type: string;
};
car?: {
active: boolean;

MODIFY
src/utils/Constants.ts
src/utils/Constants.ts
@@ -69,6 +69,7 @@ export default class Constants {
public static readonly SETTING_REFUND_CONTENT_TYPE_SAC = 'sac';
public static readonly SETTING_BILLING_CONTENT_TYPE_STRIPE = 'stripe';
public static readonly SETTING_SMART_CHARGING_CONTENT_TYPE_SAP_SMART_CHARGING = 'sapSmartCharging';
+ public static readonly SETTING_ASSET_CONTENT_TYPE_ASSET = 'asset'
public static readonly WS_DEFAULT_KEEPALIVE = 30; // Seconds
public static readonly WS_RECONNECT_DISABLED = 0;

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -1638,7 +1638,10 @@ export default class Utils {
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
// Only Asset
return {
- 'type': null,
+ 'type': Constants.SETTING_ASSET_CONTENT_TYPE_ASSET,
+ 'asset': {
+ connections: []
+ }
} as SettingDBContent;
}
break;

Save asset connection settings