Translate created badge of registered user + Updated createdOn/By
MODIFY
src/assets/i18n/en.json
src/assets/i18n/en.json
"generatedUser": "Generated user for '{{email}}'",
"chargingStopSiteArea": "Charging {{totalConsumption}} kWh at {{siteArea}} (finished at {{time}})",
"chargingStopChargeBox": "Charging {{totalConsumption}} kWh at charging station {{chargeBox}} (finished at {{time}})"
+ },
+ "tags": {
+ "virtualBadge": "Virtual Badge"
}
}

MODIFY
src/server/rest/service/AuthService.ts
src/server/rest/service/AuthService.ts
@@ -11,6 +11,7 @@ import BillingFactory from '../../../integration/billing/BillingFactory';
import Configuration from '../../../utils/Configuration';
import Constants from '../../../utils/Constants';
import { HTTPError } from '../../../types/HTTPError';
+import I18nManager from '../../../utils/I18nManager';
import Logging from '../../../utils/Logging';
import NotificationHandler from '../../../notification/NotificationHandler';
import { ServerAction } from '../../../types/Server';
@@ -246,13 +247,16 @@ export default class AuthService {
}
// Save User Status
await UserStorage.saveUserStatus(tenantID, newUser.id, UserStatus.PENDING);
+ // Get the i18n translation class
+ const i18nManager = new I18nManager(newUser.locale);
const tag: Tag = {
id: newUser.name[0] + newUser.firstName[0] + Utils.getRandomInt().toString(),
active: true,
issuer: true,
userID: newUser.id,
- lastChangedOn: new Date(),
- description: 'Virtual Tag',
+ createdBy: { id: newUser.id },
+ createdOn: new Date(),
+ description: i18nManager.translate('tags.virtualBadge'),
default: true
};
await UserStorage.saveTag(req.user.tenantID, tag);

MODIFY
src/types/Tag.ts
src/types/Tag.ts
+import CreatedUpdatedProps from './CreatedUpdatedProps';
import { OCPIToken } from './ocpi/OCPIToken';
import User from './User';
-export default interface Tag {
+export default interface Tag extends CreatedUpdatedProps {
id: string;
description?: string;
issuer: boolean;
active: boolean;
userID?: string;
- lastChangedBy?: Partial<User>;
- lastChangedOn?: Date;
transactionsCount?: number;
ocpiToken?: OCPIToken;
user?: User;

Translate created badge of registered user + Updated createdOn/By