EditDto: Clarify that the username can be null

If the edit was made by a anonymous user, we don't have a username.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-05-31 22:04:59 +02:00
parent 09329ae360
commit 57d1fc12bf
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -4,18 +4,20 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { IsDate, IsNumber, IsString, Min } from 'class-validator';
import { IsDate, IsNumber, IsOptional, IsString, Min } from 'class-validator';
import { UserInfoDto } from '../users/user-info.dto';
import { ApiProperty } from '@nestjs/swagger';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class EditDto {
/**
* Username of the user who authored this section
* Is `null` if the user is anonymous
* @example "john.smith"
*/
@IsString()
@ApiProperty()
userName: UserInfoDto['userName'];
@IsOptional()
@ApiPropertyOptional()
userName: UserInfoDto['userName'] | null;
/**
* Character index of the start of this section