mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-02-02 13:33:21 +00:00
Fix nullable property types in Note DTOs
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
64f9a29f02
commit
980da1fa43
3 changed files with 6 additions and 8 deletions
|
@ -31,7 +31,7 @@ export class NoteMetadataDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
alias?: string;
|
alias: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title of the note
|
* Title of the note
|
||||||
|
@ -74,7 +74,7 @@ export class NoteMetadataDto {
|
||||||
@ValidateNested()
|
@ValidateNested()
|
||||||
@ApiPropertyOptional({ type: UserInfoDto })
|
@ApiPropertyOptional({ type: UserInfoDto })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
updateUser?: UserInfoDto;
|
updateUser: UserInfoDto | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Counts how many times the published note has been viewed
|
* Counts how many times the published note has been viewed
|
||||||
|
|
|
@ -92,7 +92,7 @@ export class NotePermissionsDto {
|
||||||
@ValidateNested()
|
@ValidateNested()
|
||||||
@ApiPropertyOptional({ type: UserInfoDto })
|
@ApiPropertyOptional({ type: UserInfoDto })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
owner?: UserInfoDto;
|
owner: UserInfoDto | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of users the note is shared with
|
* List of users the note is shared with
|
||||||
|
|
|
@ -337,7 +337,7 @@ export class NotesService {
|
||||||
*/
|
*/
|
||||||
toNotePermissionsDto(note: Note): NotePermissionsDto {
|
toNotePermissionsDto(note: Note): NotePermissionsDto {
|
||||||
return {
|
return {
|
||||||
owner: note.owner ? this.usersService.toUserDto(note.owner) : undefined,
|
owner: note.owner ? this.usersService.toUserDto(note.owner) : null,
|
||||||
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
|
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
|
||||||
user: this.usersService.toUserDto(noteUserPermission.user),
|
user: this.usersService.toUserDto(noteUserPermission.user),
|
||||||
canEdit: noteUserPermission.canEdit,
|
canEdit: noteUserPermission.canEdit,
|
||||||
|
@ -360,7 +360,7 @@ export class NotesService {
|
||||||
return {
|
return {
|
||||||
// TODO: Convert DB UUID to base64
|
// TODO: Convert DB UUID to base64
|
||||||
id: note.id,
|
id: note.id,
|
||||||
alias: note.alias ?? undefined,
|
alias: note.alias ?? null,
|
||||||
title: note.title ?? '',
|
title: note.title ?? '',
|
||||||
createTime: (await this.getFirstRevision(note)).createdAt,
|
createTime: (await this.getFirstRevision(note)).createdAt,
|
||||||
description: note.description ?? '',
|
description: note.description ?? '',
|
||||||
|
@ -370,9 +370,7 @@ export class NotesService {
|
||||||
permissions: this.toNotePermissionsDto(note),
|
permissions: this.toNotePermissionsDto(note),
|
||||||
tags: this.toTagList(note),
|
tags: this.toTagList(note),
|
||||||
updateTime: (await this.getLatestRevision(note)).createdAt,
|
updateTime: (await this.getLatestRevision(note)).createdAt,
|
||||||
updateUser: updateUser
|
updateUser: updateUser ? this.usersService.toUserDto(updateUser) : null,
|
||||||
? this.usersService.toUserDto(updateUser)
|
|
||||||
: undefined,
|
|
||||||
viewCount: note.viewCount,
|
viewCount: note.viewCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue