changed db tree structure
modified number of settings in component activation tests
MODIFY
src/migration/tasks/MigrateUserSettingsTask.ts
src/migration/tasks/MigrateUserSettingsTask.ts
@@ -23,9 +23,9 @@ export default class MigrateUserSettingsTask extends MigrationTask {
const settingsToSave = {
identifier: UserSettingsType.USER,
content: {
- type: UserSettingsContentType.ACCOUNT_ACTIVATION,
- accountActivation: {
- doNotActivateByDefault: false
+ type: UserSettingsContentType.USER,
+ user: {
+ manualAccountActivation: false
}
},
createdOn: new Date(),

MODIFY
src/server/rest/v1/service/AuthService.ts
src/server/rest/v1/service/AuthService.ts
@@ -654,7 +654,7 @@ export default class AuthService {
});
}
const userSetting = await SettingStorage.getSettingByIdentifier(tenantID, UserSettingsType.USER);
- const userStatus = userSetting.content.accountActivation.doNotActivateByDefault ? UserStatus.INACTIVE : UserStatus.ACTIVE;
+ const userStatus = userSetting.content.user.manualAccountActivation ? UserStatus.INACTIVE : UserStatus.ACTIVE;
// Save User Status
await UserStorage.saveUserStatus(tenantID, user.id, userStatus);
// For integration with billing

MODIFY
src/server/rest/v1/service/security/SettingSecurity.ts
src/server/rest/v1/service/security/SettingSecurity.ts
@@ -188,10 +188,10 @@ export default class SettingSecurity {
settings.content.asset.connections.push(sanitizedConnection);
}
break;
- case UserSettingsContentType.ACCOUNT_ACTIVATION:
- settings.content.accountActivation =
+ case UserSettingsContentType.USER:
+ settings.content.user =
{
- doNotActivateByDefault: request.content.accountActivation.doNotActivateByDefault
+ manualAccountActivation: request.content.user.manualAccountActivation
};
break;
}

MODIFY
src/storage/mongodb/SettingStorage.ts
src/storage/mongodb/SettingStorage.ts
-import { AnalyticsSettings, AnalyticsSettingsType, AssetSettings, AssetSettingsType, BillingSettings, BillingSettingsType, CryptoKeySetting, CryptoSetting, CryptoSettingsType, PricingSettings, PricingSettingsType, RefundSettings, RefundSettingsType, RoamingSettings, SettingDB, SmartChargingSettings, SmartChargingSettingsType, UserSetting, UserSettingsType } from '../../types/Setting';
+import { AnalyticsSettings, AnalyticsSettingsType, AssetSettings, AssetSettingsType, BillingSettings, BillingSettingsType, CryptoKeySetting, CryptoSetting, CryptoSettingsType, PricingSettings, PricingSettingsType, RefundSettings, RefundSettingsType, RoamingSettings, SettingDB, SmartChargingSettings, SmartChargingSettingsType, UserSetting, UserSettings, UserSettingsType } from '../../types/Setting';
import global, { FilterParams } from '../../types/GlobalType';
import BackendError from '../../exception/BackendError';

MODIFY
src/types/Setting.ts
src/types/Setting.ts
@@ -32,7 +32,7 @@ export interface SettingDBContent {
sapSmartCharging?: SapSmartChargingSetting;
asset?: AssetSetting;
crypto?: CryptoSetting;
- accountActivation?: AccountActivationSetting;
+ user?: UserSettings;
}
export enum PricingSettingsType {
@@ -275,13 +275,13 @@ export enum UserSettingsType {
}
export enum UserSettingsContentType {
- ACCOUNT_ACTIVATION = 'accountActivation',
+ USER = 'user',
}
export interface UserSetting extends Setting {
identifier: UserSettingsType.USER;
- accountActivation?: AccountActivationSetting;
+ user?: UserSettings;
}
-export interface AccountActivationSetting {
- doNotActivateByDefault: boolean;
+export interface UserSettings {
+ manualAccountActivation: boolean;
}

MODIFY
test/api/ComponentActivationTenantTest.ts
test/api/ComponentActivationTenantTest.ts
@@ -103,7 +103,7 @@ describe('Tenant Settings test', function() {
expect(res.status).to.equal(200);
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
- expect(settings.data.count).to.equal(2);
+ expect(settings.data.count).to.equal(3);
expect(settings.data.result[1]).to.be.validatedSetting(TenantComponents.OCPI, RoamingSettingsType.GIREVE);
});
@@ -132,7 +132,7 @@ describe('Tenant Settings test', function() {
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
expect(settings.status).to.equal(200);
- expect(settings.data.count).to.equal(2);
+ expect(settings.data.count).to.equal(3);
expect(settings.data.result[1]).to.be.validatedSetting(TenantComponents.PRICING, PricingSettingsType.SIMPLE);
});
@@ -183,7 +183,7 @@ describe('Tenant Settings test', function() {
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
expect(settings.status).to.equal(200);
- expect(settings.data.count).to.equal(3);
+ expect(settings.data.count).to.equal(4);
expect(settings.data.result[0]).to.be.validatedSetting(TenantComponents.BILLING, BillingSettingsType.STRIPE);
expect(settings.data.result[2]).to.be.validatedSetting(TenantComponents.PRICING, PricingSettingsType.SIMPLE);
});
@@ -234,7 +234,7 @@ describe('Tenant Settings test', function() {
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
expect(settings.status).to.equal(200);
- expect(settings.data.count).to.equal(3);
+ expect(settings.data.count).to.equal(4);
expect(settings.data.result[1]).to.be.validatedSetting(TenantComponents.PRICING, PricingSettingsType.SIMPLE);
expect(settings.data.result[2]).to.be.validatedSetting(TenantComponents.REFUND, RefundSettingsType.CONCUR);
});
@@ -284,7 +284,7 @@ describe('Tenant Settings test', function() {
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
expect(settings.status).to.equal(200);
- expect(settings.data.count).to.equal(2);
+ expect(settings.data.count).to.equal(3);
expect(settings.data.result[1]).to.be.validatedSetting('smartCharging', 'sapSmartCharging');
});
@@ -312,7 +312,7 @@ describe('Tenant Settings test', function() {
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
expect(settings.status).to.equal(200);
- expect(settings.data.count).to.equal(2);
+ expect(settings.data.count).to.equal(3);
expect(settings.data.result[1]).to.be.validatedSetting(TenantComponents.PRICING, PricingSettingsType.CONVERGENT_CHARGING);
});
@@ -341,7 +341,7 @@ describe('Tenant Settings test', function() {
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
expect(settings.status).to.equal(200);
- expect(settings.data.count).to.equal(2);
+ expect(settings.data.count).to.equal(3);
expect(settings.data.result[0]).to.be.validatedSetting(TenantComponents.ANALYTICS, AnalyticsSettingsType.SAC);
});
@@ -390,7 +390,7 @@ describe('Tenant Settings test', function() {
expect(res.status).to.equal(200);
testData.connectUser();
const settings = await testData.centralService.settingApi.readAll({});
- expect(settings.data.count).to.equal(2);
+ expect(settings.data.count).to.equal(3);
expect(settings.data.result[0]).to.be.validatedSetting(TenantComponents.ASSET, null);
});
});

changed db tree structure
modified number of settings in component activation tests