eventlog: add Json suffix to json fields

This commit is contained in:
Girish Ramakrishnan
2021-11-17 12:21:46 -08:00
parent 7f45e1db06
commit e71d932de0
4 changed files with 29 additions and 10 deletions

View File

@@ -102,7 +102,7 @@ describe('Eventlog', function () {
let yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
await database.query('INSERT INTO eventlog (id, action, source, data, creationTime) VALUES (?, ?, ?, ?, ?)', [ 'anotherid', 'user.login2', JSON.stringify({ ip: '1.2.3.4' }), JSON.stringify({ appId: 'thatapp' }), yesterday ]);
await database.query('INSERT INTO eventlog (id, action, sourceJson, dataJson, creationTime) VALUES (?, ?, ?, ?, ?)', [ 'anotherid', 'user.login2', JSON.stringify({ ip: '1.2.3.4' }), JSON.stringify({ appId: 'thatapp' }), yesterday ]);
const result = await eventlog.upsertLoginEvent('user.login2', { ip: '1.2.3.4' }, { appId: 'thatapp' });
expect(result).to.not.equal('anotherid');