History: Add history service and usage

Add history service to allow for CRUD operations.
Use history service in controllers to:
  1. Allow manipulating of history entries
  2. Guaranty the correct existence of history entries

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-02-03 21:22:55 +01:00 committed by David Mehren
parent 300b464efd
commit e55e62c2cd
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
8 changed files with 173 additions and 118 deletions

View file

@ -85,7 +85,7 @@ describe('Notes', () => {
.delete('/me/history/test3')
.expect(204);
expect(response.body.content).toBeNull();
const history = historyService.getUserHistory('testuser');
const history = historyService.getEntriesByUser('testuser');
let historyEntry: HistoryEntryDto = null;
for (const e of history) {
if (e.metadata.alias === noteName) {
@ -106,7 +106,7 @@ describe('Notes', () => {
.send(historyEntryUpdateDto)
.expect(200);
// TODO parameter is not used for now
const history = historyService.getUserHistory('testuser');
const history = historyService.getEntriesByUser('testuser');
let historyEntry: HistoryEntryDto;
for (const e of <any[]>response.body.content) {
if ((<HistoryEntryDto>e).metadata.alias === noteName) {