Consistently type properties as optional

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-04-29 18:29:12 +02:00
parent bc08493f89
commit e217b30d26
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 15 additions and 7 deletions

View file

@ -31,7 +31,7 @@ export class NoteMetadataDto {
@IsString()
@IsOptional()
@ApiPropertyOptional()
alias: string;
alias?: string;
/**
* Title of the note
@ -72,8 +72,9 @@ export class NoteMetadataDto {
* User that last edited the note
*/
@ValidateNested()
@ApiProperty({ type: UserInfoDto })
updateUser: UserInfoDto;
@ApiPropertyOptional({ type: UserInfoDto })
@IsOptional()
updateUser?: UserInfoDto;
/**
* Counts how many times the published note has been viewed

View file

@ -4,10 +4,16 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { IsArray, IsBoolean, IsString, ValidateNested } from 'class-validator';
import {
IsArray,
IsBoolean,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
import { UserInfoDto } from '../users/user-info.dto';
import { GroupInfoDto } from '../groups/group-info.dto';
import { ApiProperty } from '@nestjs/swagger';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class NoteUserPermissionEntryDto {
/**
@ -84,8 +90,9 @@ export class NotePermissionsDto {
* User this permission applies to
*/
@ValidateNested()
@ApiProperty({ type: UserInfoDto })
owner: UserInfoDto;
@ApiPropertyOptional({ type: UserInfoDto })
@IsOptional()
owner?: UserInfoDto;
/**
* List of users the note is shared with