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()
@Type(() => Date)
lastVisited: Date;
lastVisitedAt: Date;
}
export class HistoryEntryImportListDto extends BaseDto {

View file

@ -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,

View file

@ -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<HistoryEntry>(entry);
}
});

View file

@ -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')