replace signing with login / fix user tests
MODIFY
src/server/rest/v1/service/AuthService.ts
src/server/rest/v1/service/AuthService.ts
@@ -863,7 +863,7 @@ export default class AuthService {
action: action, message: 'User logged in successfully'
});
// Set Eula Info on Login Only
- if (action === 'Login') {
+ if (action === ServerAction.REST_SIGNIN) {
// Save EULA
const endUserLicenseAgreement = await UserStorage.getEndUserLicenseAgreement(tenantID, Utils.getLanguageFromLocale(user.locale));
await UserStorage.saveUserEULA(tenantID, user.id,

MODIFY
src/server/rest/v1/service/TagService.ts
src/server/rest/v1/service/TagService.ts
@@ -153,10 +153,12 @@ export default class TagService {
const firstActiveTag = await TagStorage.getFirstActiveUserTag(req.user.tenantID, tag.userID, {
issuer: true,
});
+ if (firstActiveTag) {
// Set default
firstActiveTag.default = true;
await TagStorage.saveTag(req.user.tenantID, firstActiveTag);
}
+ }
// OCPI
if (Utils.isComponentActiveFromToken(req.user, TenantComponents.OCPI)) {
try {

MODIFY
test/api/UserTest.ts
test/api/UserTest.ts
@@ -175,12 +175,12 @@ describe('User tests', function() {
const tagId = testData.newTag.id;
const meterStart = 180;
const startDate = moment();
- let response = await testData.chargingStationContext.startTransaction(
+ const response = await testData.chargingStationContext.startTransaction(
connectorId, tagId, meterStart, startDate.toDate());
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(response).to.be.transactionValid;
- response = await testData.userService.userApi.deleteTag(tagId);
- expect(response.idTagInfo.status).to.equal(575);
+ const resDelete = await testData.userService.userApi.deleteTag(tagId);
+ expect(resDelete.status).to.equal(575);
const tag = (await testData.userService.userApi.readTag(tagId)).data;
expect(tag).to.not.be.null;
});

MODIFY
test/factories/TagFactory.ts
test/factories/TagFactory.ts
@@ -5,4 +5,5 @@ export default Factory.define('tag')
.attr('id', () => faker.random.alphaNumeric(20).toString().toUpperCase())
.attr('active', true)
.attr('issuer', () => true)
+ .attr('default', () => false)
.attr('description', () => 'Tag for unit test');

replace signing with login / fix user tests