mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
refactor(note-metadata): rename date attributes
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:
parent
b0e2987987
commit
f1feb3bf94
4 changed files with 11 additions and 11 deletions
|
@ -72,7 +72,7 @@ export class NoteMetadataDto {
|
|||
*/
|
||||
@IsDate()
|
||||
@ApiProperty()
|
||||
updateTime: Date;
|
||||
updatedAt: Date;
|
||||
|
||||
/**
|
||||
* User that last edited the note
|
||||
|
@ -96,7 +96,7 @@ export class NoteMetadataDto {
|
|||
*/
|
||||
@IsDate()
|
||||
@ApiProperty()
|
||||
createTime: Date;
|
||||
createdAt: Date;
|
||||
|
||||
/**
|
||||
* List of usernames that edited the note
|
||||
|
|
|
@ -773,7 +773,7 @@ describe('NotesService', () => {
|
|||
expect(metadataDto.aliases).toHaveLength(1);
|
||||
expect(metadataDto.aliases[0]).toEqual((await note.aliases)[0].name);
|
||||
expect(metadataDto.title).toEqual(note.title);
|
||||
expect(metadataDto.createTime).toEqual(revisions[0].createdAt);
|
||||
expect(metadataDto.createdAt).toEqual(revisions[0].createdAt);
|
||||
expect(metadataDto.description).toEqual(note.description);
|
||||
expect(metadataDto.editedBy).toHaveLength(1);
|
||||
expect(metadataDto.editedBy[0]).toEqual(user.username);
|
||||
|
@ -790,7 +790,7 @@ describe('NotesService', () => {
|
|||
expect(metadataDto.permissions.sharedToGroups[0].canEdit).toEqual(true);
|
||||
expect(metadataDto.tags).toHaveLength(1);
|
||||
expect(metadataDto.tags[0]).toEqual((await note.tags)[0].name);
|
||||
expect(metadataDto.updateTime).toEqual(revisions[0].createdAt);
|
||||
expect(metadataDto.updatedAt).toEqual(revisions[0].createdAt);
|
||||
expect(metadataDto.updateUser.username).toEqual(user.username);
|
||||
expect(metadataDto.viewCount).toEqual(note.viewCount);
|
||||
});
|
||||
|
@ -875,7 +875,7 @@ describe('NotesService', () => {
|
|||
expect(noteDto.metadata.aliases).toHaveLength(1);
|
||||
expect(noteDto.metadata.aliases[0]).toEqual((await note.aliases)[0].name);
|
||||
expect(noteDto.metadata.title).toEqual(note.title);
|
||||
expect(noteDto.metadata.createTime).toEqual(revisions[0].createdAt);
|
||||
expect(noteDto.metadata.createdAt).toEqual(revisions[0].createdAt);
|
||||
expect(noteDto.metadata.description).toEqual(note.description);
|
||||
expect(noteDto.metadata.editedBy).toHaveLength(1);
|
||||
expect(noteDto.metadata.editedBy[0]).toEqual(user.username);
|
||||
|
@ -898,7 +898,7 @@ describe('NotesService', () => {
|
|||
);
|
||||
expect(noteDto.metadata.tags).toHaveLength(1);
|
||||
expect(noteDto.metadata.tags[0]).toEqual((await note.tags)[0].name);
|
||||
expect(noteDto.metadata.updateTime).toEqual(revisions[0].createdAt);
|
||||
expect(noteDto.metadata.updatedAt).toEqual(revisions[0].createdAt);
|
||||
expect(noteDto.metadata.updateUser.username).toEqual(user.username);
|
||||
expect(noteDto.metadata.viewCount).toEqual(note.viewCount);
|
||||
expect(noteDto.content).toEqual(content);
|
||||
|
|
|
@ -400,12 +400,12 @@ export class NotesService {
|
|||
),
|
||||
primaryAlias: (await getPrimaryAlias(note)) ?? null,
|
||||
title: note.title ?? '',
|
||||
createTime: (await this.getFirstRevision(note)).createdAt,
|
||||
createdAt: (await this.getFirstRevision(note)).createdAt,
|
||||
description: note.description ?? '',
|
||||
editedBy: (await this.getAuthorUsers(note)).map((user) => user.username),
|
||||
permissions: await this.toNotePermissionsDto(note),
|
||||
tags: await this.toTagList(note),
|
||||
updateTime: (await this.getLatestRevision(note)).createdAt,
|
||||
updatedAt: (await this.getLatestRevision(note)).createdAt,
|
||||
updateUser: updateUser ? this.usersService.toUserDto(updateUser) : null,
|
||||
viewCount: note.viewCount,
|
||||
};
|
||||
|
|
|
@ -274,13 +274,13 @@ describe('Notes', () => {
|
|||
expect(metadata.body.primaryAlias).toEqual('test5');
|
||||
expect(metadata.body.title).toEqual('');
|
||||
expect(metadata.body.description).toEqual('');
|
||||
expect(typeof metadata.body.createTime).toEqual('string');
|
||||
expect(typeof metadata.body.createdAt).toEqual('string');
|
||||
expect(metadata.body.editedBy).toEqual([]);
|
||||
expect(metadata.body.permissions.owner.username).toEqual('hardcoded');
|
||||
expect(metadata.body.permissions.sharedToUsers).toEqual([]);
|
||||
expect(metadata.body.permissions.sharedToUsers).toEqual([]);
|
||||
expect(metadata.body.tags).toEqual([]);
|
||||
expect(typeof metadata.body.updateTime).toEqual('string');
|
||||
expect(typeof metadata.body.updatedAt).toEqual('string');
|
||||
expect(typeof metadata.body.updateUser.displayName).toEqual('string');
|
||||
expect(typeof metadata.body.updateUser.username).toEqual('string');
|
||||
expect(typeof metadata.body.updateUser.email).toEqual('string');
|
||||
|
@ -320,7 +320,7 @@ describe('Notes', () => {
|
|||
const metadata = await request(testSetup.app.getHttpServer())
|
||||
.get('/api/v2/notes/test5a/metadata')
|
||||
.expect(200);
|
||||
expect(metadata.body.createTime).toEqual(createDate.toISOString());
|
||||
expect(metadata.body.createdAt).toEqual(createDate.toISOString());
|
||||
expect(metadata.body.updateTime).not.toEqual(createDate.toISOString());
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue