From 3233b5c9583dcd084bfc679fb17e84628dbdf254 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Mon, 25 Jan 2021 22:23:09 +0100 Subject: [PATCH] NoteMetadata DTOs: Add doc comments Signed-off-by: David Mehren --- src/notes/note-metadata.dto.ts | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/notes/note-metadata.dto.ts b/src/notes/note-metadata.dto.ts index 25872baac..638e545a5 100644 --- a/src/notes/note-metadata.dto.ts +++ b/src/notes/note-metadata.dto.ts @@ -8,6 +8,7 @@ import { IsArray, IsDate, IsNumber, + IsOptional, IsString, ValidateNested, } from 'class-validator'; @@ -15,37 +16,107 @@ import { UserInfoDto } from '../users/user-info.dto'; import { NotePermissionsDto } from './note-permissions.dto'; export class NoteMetadataDto { + /** + * ID of the note + */ @IsString() id: string; + + /** + * Alias of the note + * Can be null + */ @IsString() + @IsOptional() alias: string; + + /** + * Title of the note + * Does not contain any markup but might be empty + * @example "Shopping List" + */ @IsString() title: string; + + /** + * Description of the note + * Does not contain any markup but might be empty + * @example Everything I want to buy + */ @IsString() description: string; + + /** + * List of tags assigned to this note + * @example "['shopping', 'personal'] + */ @IsArray() @IsString({ each: true }) tags: string[]; + + /** + * Datestring of the last time this note was updated + * @example "2020-12-01 12:23:34" + */ @IsDate() updateTime: Date; + + /** + * User that last edited the note + */ @ValidateNested() updateUser: UserInfoDto; + + /** + * Counts how many times the published note has been viewed + * @example 42 + */ @IsNumber() viewCount: number; + + /** + * Datestring of the time this note was created + * @example "2020-12-01 12:23:34" + */ @IsDate() createTime: Date; + + /** + * List of usernames that edited the note + * @example "['john.smith', 'jane.smith']" + */ @IsArray() @ValidateNested() editedBy: UserInfoDto['userName'][]; + + /** + * Permissions currently in effect for the note + */ @ValidateNested() permissions: NotePermissionsDto; } export class NoteMetadataUpdateDto { + /** + * New title of the note + * Can not contain any markup and might be empty + * @example "Shopping List" + */ @IsString() title: string; + + /** + * New description of the note + * Can not contain any markup but might be empty + * @example Everything I want to buy + */ @IsString() description: string; + + /** + * New list of tags assigned to this note + * @example "['shopping', 'personal'] + */ @IsArray() @IsString({ each: true }) tags: string[];