hedgedoc/src/revisions/edit.dto.ts
David Mehren 57d1fc12bf
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>
2021-05-31 22:16:06 +02:00

56 lines
1.2 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { IsDate, IsNumber, IsOptional, IsString, Min } from 'class-validator';
import { UserInfoDto } from '../users/user-info.dto';
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()
@IsOptional()
@ApiPropertyOptional()
userName: UserInfoDto['userName'] | null;
/**
* Character index of the start of this section
* @example 102
*/
@IsNumber()
@Min(0)
@ApiProperty()
startPos: number;
/**
* Character index of the end of this section
* Must be greater than {@link startPos}
* @example 154
*/
@IsNumber()
@Min(0)
@ApiProperty()
endPos: number;
/**
* Datestring of the time this section was created
* @example "2020-12-01 12:23:34"
*/
@IsDate()
@ApiProperty()
createdAt: Date;
/**
* Datestring of the last time this section was edited
* @example "2020-12-01 12:23:34"
*/
@IsDate()
@ApiProperty()
updatedAt: Date;
}