From 1fd15cc3764706d00e94c93a84c09c46a9750400 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sat, 7 Aug 2021 21:54:42 +0200 Subject: [PATCH] chore: add alias dtos Signed-off-by: Philip Molares --- src/notes/alias-create.dto.ts | 23 +++++++++++++++++++++++ src/notes/alias-update.dto.ts | 16 ++++++++++++++++ src/notes/alias.dto.ts | 30 ++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 src/notes/alias-create.dto.ts create mode 100644 src/notes/alias-update.dto.ts create mode 100644 src/notes/alias.dto.ts diff --git a/src/notes/alias-create.dto.ts b/src/notes/alias-create.dto.ts new file mode 100644 index 000000000..2da4dd841 --- /dev/null +++ b/src/notes/alias-create.dto.ts @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { ApiProperty } from '@nestjs/swagger'; +import { IsString } from 'class-validator'; + +export class AliasCreateDto { + /** + * The note id or alias, which identifies the note the alias should be added to + */ + @IsString() + @ApiProperty() + noteIdOrAlias: string; + + /** + * The new alias + */ + @IsString() + @ApiProperty() + newAlias: string; +} diff --git a/src/notes/alias-update.dto.ts b/src/notes/alias-update.dto.ts new file mode 100644 index 000000000..318c86680 --- /dev/null +++ b/src/notes/alias-update.dto.ts @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { ApiProperty } from '@nestjs/swagger'; +import { IsBoolean } from 'class-validator'; + +export class AliasUpdateDto { + /** + * Whether the alias should become the primary alias or not + */ + @IsBoolean() + @ApiProperty() + primaryAlias: boolean; +} diff --git a/src/notes/alias.dto.ts b/src/notes/alias.dto.ts new file mode 100644 index 000000000..dccaddc23 --- /dev/null +++ b/src/notes/alias.dto.ts @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { ApiProperty } from '@nestjs/swagger'; +import { IsBoolean, IsString } from 'class-validator'; + +export class AliasDto { + /** + * The name of the alias + */ + @IsString() + @ApiProperty() + name: string; + + /** + * Is the alias the primary alias or not + */ + @IsBoolean() + @ApiProperty() + primaryAlias: boolean; + + /** + * The public id of the note the alias is associated with + */ + @IsString() + @ApiProperty() + noteId: string; +}