From e7ca10bb667d514f1e0788f01667ab4c38a35b98 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 27 Feb 2022 20:24:23 +0100 Subject: [PATCH] refactor(history-entry-import-dto): rename lastVisited -> lastVisitedAt Signed-off-by: David Mehren --- src/history/history-entry-import.dto.ts | 2 +- src/history/history.service.spec.ts | 4 ++-- src/history/history.service.ts | 2 +- test/private-api/history.e2e-spec.ts | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/history/history-entry-import.dto.ts b/src/history/history-entry-import.dto.ts index fda32323b..92c79d394 100644 --- a/src/history/history-entry-import.dto.ts +++ b/src/history/history-entry-import.dto.ts @@ -34,7 +34,7 @@ export class HistoryEntryImportDto extends BaseDto { */ @IsDate() @Type(() => Date) - lastVisited: Date; + lastVisitedAt: Date; } export class HistoryEntryImportListDto extends BaseDto { diff --git a/src/history/history.service.spec.ts b/src/history/history.service.spec.ts index f139a86a3..c1bdc3b29 100644 --- a/src/history/history.service.spec.ts +++ b/src/history/history.service.spec.ts @@ -356,14 +356,14 @@ describe('HistoryService', () => { const note = Note.create(user, alias) as Note; const historyEntry = HistoryEntry.create(user, note); const historyEntryImport: HistoryEntryImportDto = { - lastVisited: new Date('2020-12-01 12:23:34'), + lastVisitedAt: new Date('2020-12-01 12:23:34'), note: alias, pinStatus: true, }; const newlyCreatedHistoryEntry: HistoryEntry = { ...historyEntry, pinStatus: historyEntryImport.pinStatus, - updatedAt: historyEntryImport.lastVisited, + updatedAt: historyEntryImport.lastVisitedAt, }; const createQueryBuilder = { leftJoinAndSelect: () => createQueryBuilder, diff --git a/src/history/history.service.ts b/src/history/history.service.ts index 3578a88e1..e551e3bda 100644 --- a/src/history/history.service.ts +++ b/src/history/history.service.ts @@ -162,7 +162,7 @@ export class HistoryService { ); const entry = HistoryEntry.create(user, note) as HistoryEntry; entry.pinStatus = historyEntry.pinStatus; - entry.updatedAt = historyEntry.lastVisited; + entry.updatedAt = historyEntry.lastVisitedAt; await manager.save(entry); } }); diff --git a/test/private-api/history.e2e-spec.ts b/test/private-api/history.e2e-spec.ts index 750337eac..1d9d60771 100644 --- a/test/private-api/history.e2e-spec.ts +++ b/test/private-api/history.e2e-spec.ts @@ -93,7 +93,7 @@ describe('History', () => { (alias) => alias.primary, )[0].name; postEntryDto.pinStatus = pinStatus; - postEntryDto.lastVisited = lastVisited; + postEntryDto.lastVisitedAt = lastVisited; await agent .post('/api/private/me/history') .set('Content-Type', 'application/json') @@ -132,13 +132,13 @@ describe('History', () => { (alias) => alias.primary, )[0].name; postEntryDto.pinStatus = pinStatus; - postEntryDto.lastVisited = lastVisited; + postEntryDto.lastVisitedAt = lastVisited; }); it('with forbiddenId', async () => { const brokenEntryDto = new HistoryEntryImportDto(); brokenEntryDto.note = forbiddenNoteId; brokenEntryDto.pinStatus = pinStatus; - brokenEntryDto.lastVisited = lastVisited; + brokenEntryDto.lastVisitedAt = lastVisited; await agent .post('/api/private/me/history') .set('Content-Type', 'application/json') @@ -149,7 +149,7 @@ describe('History', () => { const brokenEntryDto = new HistoryEntryImportDto(); brokenEntryDto.note = 'i_dont_exist'; brokenEntryDto.pinStatus = pinStatus; - brokenEntryDto.lastVisited = lastVisited; + brokenEntryDto.lastVisitedAt = lastVisited; await agent .post('/api/private/me/history') .set('Content-Type', 'application/json')