refactor(history-entry): rename lastVisited

This is part of an effort to name all date attributes
consistently.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-01-16 22:04:34 +01:00
parent 05e534a7d6
commit e2c2657b53
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
4 changed files with 9 additions and 9 deletions

View file

@ -29,7 +29,7 @@ export class HistoryEntryDto {
*/ */
@IsDate() @IsDate()
@ApiProperty() @ApiProperty()
lastVisited: Date; lastVisitedAt: Date;
@IsArray() @IsArray()
@IsString({ each: true }) @IsString({ each: true })

View file

@ -189,7 +189,7 @@ export class HistoryService {
async toHistoryEntryDto(entry: HistoryEntry): Promise<HistoryEntryDto> { async toHistoryEntryDto(entry: HistoryEntry): Promise<HistoryEntryDto> {
return { return {
identifier: await getIdentifier(entry), identifier: await getIdentifier(entry),
lastVisited: entry.updatedAt, lastVisitedAt: entry.updatedAt,
tags: await this.notesService.toTagList(entry.note), tags: await this.notesService.toTagList(entry.note),
title: entry.note.title ?? '', title: entry.note.title ?? '',
pinStatus: entry.pinStatus, pinStatus: entry.pinStatus,

View file

@ -79,8 +79,8 @@ describe('History', () => {
expect(response.body[0].title).toEqual(entryDto.title); expect(response.body[0].title).toEqual(entryDto.title);
expect(response.body[0].tags).toEqual(entryDto.tags); expect(response.body[0].tags).toEqual(entryDto.tags);
expect(response.body[0].pinStatus).toEqual(entryDto.pinStatus); expect(response.body[0].pinStatus).toEqual(entryDto.pinStatus);
expect(response.body[0].lastVisited).toEqual( expect(response.body[0].lastVisitedAt).toEqual(
entryDto.lastVisited.toISOString(), entryDto.lastVisitedAt.toISOString(),
); );
}); });
@ -218,7 +218,7 @@ describe('History', () => {
expect(userEntryDto.title).toEqual(entryDto.title); expect(userEntryDto.title).toEqual(entryDto.title);
expect(userEntryDto.tags).toEqual(entryDto.tags); expect(userEntryDto.tags).toEqual(entryDto.tags);
expect(userEntryDto.pinStatus).toEqual(entryDto.pinStatus); expect(userEntryDto.pinStatus).toEqual(entryDto.pinStatus);
expect(userEntryDto.lastVisited).toEqual(entryDto.lastVisited); expect(userEntryDto.lastVisitedAt).toEqual(entryDto.lastVisitedAt);
}); });
afterAll(async () => { afterAll(async () => {

View file

@ -59,8 +59,8 @@ describe('Me', () => {
expect(historyEntry.title).toEqual(historyDto.title); expect(historyEntry.title).toEqual(historyDto.title);
expect(historyEntry.tags).toEqual(historyDto.tags); expect(historyEntry.tags).toEqual(historyDto.tags);
expect(historyEntry.pinStatus).toEqual(historyDto.pinStatus); expect(historyEntry.pinStatus).toEqual(historyDto.pinStatus);
expect(historyEntry.lastVisited).toEqual( expect(historyEntry.lastVisitedAt).toEqual(
historyDto.lastVisited.toISOString(), historyDto.lastVisitedAt.toISOString(),
); );
} }
}); });
@ -83,8 +83,8 @@ describe('Me', () => {
expect(historyEntry.title).toEqual(historyEntryDto.title); expect(historyEntry.title).toEqual(historyEntryDto.title);
expect(historyEntry.tags).toEqual(historyEntryDto.tags); expect(historyEntry.tags).toEqual(historyEntryDto.tags);
expect(historyEntry.pinStatus).toEqual(historyEntryDto.pinStatus); expect(historyEntry.pinStatus).toEqual(historyEntryDto.pinStatus);
expect(historyEntry.lastVisited).toEqual( expect(historyEntry.lastVisitedAt).toEqual(
historyEntryDto.lastVisited.toISOString(), historyEntryDto.lastVisitedAt.toISOString(),
); );
}); });
it('fails with a non-existing note', async () => { it('fails with a non-existing note', async () => {