refactor(history-entry-import-dto): rename lastVisited -> lastVisitedAt

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-02-27 20:24:23 +01:00
parent 2605e8894d
commit e7ca10bb66
4 changed files with 8 additions and 8 deletions

View file

@ -34,7 +34,7 @@ export class HistoryEntryImportDto extends BaseDto {
*/ */
@IsDate() @IsDate()
@Type(() => Date) @Type(() => Date)
lastVisited: Date; lastVisitedAt: Date;
} }
export class HistoryEntryImportListDto extends BaseDto { export class HistoryEntryImportListDto extends BaseDto {

View file

@ -356,14 +356,14 @@ describe('HistoryService', () => {
const note = Note.create(user, alias) as Note; const note = Note.create(user, alias) as Note;
const historyEntry = HistoryEntry.create(user, note); const historyEntry = HistoryEntry.create(user, note);
const historyEntryImport: HistoryEntryImportDto = { const historyEntryImport: HistoryEntryImportDto = {
lastVisited: new Date('2020-12-01 12:23:34'), lastVisitedAt: new Date('2020-12-01 12:23:34'),
note: alias, note: alias,
pinStatus: true, pinStatus: true,
}; };
const newlyCreatedHistoryEntry: HistoryEntry = { const newlyCreatedHistoryEntry: HistoryEntry = {
...historyEntry, ...historyEntry,
pinStatus: historyEntryImport.pinStatus, pinStatus: historyEntryImport.pinStatus,
updatedAt: historyEntryImport.lastVisited, updatedAt: historyEntryImport.lastVisitedAt,
}; };
const createQueryBuilder = { const createQueryBuilder = {
leftJoinAndSelect: () => createQueryBuilder, leftJoinAndSelect: () => createQueryBuilder,

View file

@ -162,7 +162,7 @@ export class HistoryService {
); );
const entry = HistoryEntry.create(user, note) as HistoryEntry; const entry = HistoryEntry.create(user, note) as HistoryEntry;
entry.pinStatus = historyEntry.pinStatus; entry.pinStatus = historyEntry.pinStatus;
entry.updatedAt = historyEntry.lastVisited; entry.updatedAt = historyEntry.lastVisitedAt;
await manager.save<HistoryEntry>(entry); await manager.save<HistoryEntry>(entry);
} }
}); });

View file

@ -93,7 +93,7 @@ describe('History', () => {
(alias) => alias.primary, (alias) => alias.primary,
)[0].name; )[0].name;
postEntryDto.pinStatus = pinStatus; postEntryDto.pinStatus = pinStatus;
postEntryDto.lastVisited = lastVisited; postEntryDto.lastVisitedAt = lastVisited;
await agent await agent
.post('/api/private/me/history') .post('/api/private/me/history')
.set('Content-Type', 'application/json') .set('Content-Type', 'application/json')
@ -132,13 +132,13 @@ describe('History', () => {
(alias) => alias.primary, (alias) => alias.primary,
)[0].name; )[0].name;
postEntryDto.pinStatus = pinStatus; postEntryDto.pinStatus = pinStatus;
postEntryDto.lastVisited = lastVisited; postEntryDto.lastVisitedAt = lastVisited;
}); });
it('with forbiddenId', async () => { it('with forbiddenId', async () => {
const brokenEntryDto = new HistoryEntryImportDto(); const brokenEntryDto = new HistoryEntryImportDto();
brokenEntryDto.note = forbiddenNoteId; brokenEntryDto.note = forbiddenNoteId;
brokenEntryDto.pinStatus = pinStatus; brokenEntryDto.pinStatus = pinStatus;
brokenEntryDto.lastVisited = lastVisited; brokenEntryDto.lastVisitedAt = lastVisited;
await agent await agent
.post('/api/private/me/history') .post('/api/private/me/history')
.set('Content-Type', 'application/json') .set('Content-Type', 'application/json')
@ -149,7 +149,7 @@ describe('History', () => {
const brokenEntryDto = new HistoryEntryImportDto(); const brokenEntryDto = new HistoryEntryImportDto();
brokenEntryDto.note = 'i_dont_exist'; brokenEntryDto.note = 'i_dont_exist';
brokenEntryDto.pinStatus = pinStatus; brokenEntryDto.pinStatus = pinStatus;
brokenEntryDto.lastVisited = lastVisited; brokenEntryDto.lastVisitedAt = lastVisited;
await agent await agent
.post('/api/private/me/history') .post('/api/private/me/history')
.set('Content-Type', 'application/json') .set('Content-Type', 'application/json')