From a83a7c7a663a3ad1fa1f67024c6925218737fe6d Mon Sep 17 00:00:00 2001 From: David Mehren Date: Mon, 25 Jan 2021 22:22:52 +0100 Subject: [PATCH] NotePermission DTOs: Add doc comments Signed-off-by: David Mehren --- src/notes/note-permissions.dto.ts | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/notes/note-permissions.dto.ts b/src/notes/note-permissions.dto.ts index 2962c8894..55bb1c7b9 100644 --- a/src/notes/note-permissions.dto.ts +++ b/src/notes/note-permissions.dto.ts @@ -8,57 +8,124 @@ import { IsArray, IsBoolean, IsString, ValidateNested } from 'class-validator'; import { UserInfoDto } from '../users/user-info.dto'; export class NoteUserPermissionEntryDto { + /** + * User this permission applies to + */ @ValidateNested() user: UserInfoDto; + + /** + * True if the user is allowed to edit the note + * @example false + */ @IsBoolean() canEdit: boolean; } export class NoteUserPermissionUpdateDto { + /** + * Username of the user this permission should apply to + * @example "john.smith" + */ @IsString() username: string; + + /** + * True if the user should be allowed to edit the note + * @example false + */ @IsBoolean() canEdit: boolean; } export class GroupInfoDto { + /** + * Name of the group + * @example "superheroes" + */ @IsString() name: string; + + /** + * Display name of this group + * @example "Superheroes" + */ @IsString() displayName: string; + + /** + * True if this group must be specially handled + * Used for e.g. "everybody", "all logged in users" + * @example false + */ @IsBoolean() special: boolean; } export class NoteGroupPermissionEntryDto { + /** + * Group this permission applies to + */ @ValidateNested() group: GroupInfoDto; + + /** + * True if the group members are allowed to edit the note + * @example false + */ @IsBoolean() canEdit: boolean; } export class NoteGroupPermissionUpdateDto { + /** + * Name of the group this permission should apply to + * @example "superheroes" + */ @IsString() groupname: string; + + /** + * True if the group members should be allowed to edit the note + * @example false + */ @IsBoolean() canEdit: boolean; } export class NotePermissionsDto { + /** + * User this permission applies to + */ @ValidateNested() owner: UserInfoDto; + + /** + * List of users the note is shared with + */ @ValidateNested() @IsArray() sharedToUsers: NoteUserPermissionEntryDto[]; + + /** + * List of groups the note is shared with + */ @ValidateNested() @IsArray() sharedToGroups: NoteGroupPermissionEntryDto[]; } export class NotePermissionsUpdateDto { + /** + * List of users the note should be shared with + */ @IsArray() @ValidateNested() sharedToUsers: NoteUserPermissionUpdateDto[]; + + /** + * List of groups the note should be shared with + */ @IsArray() @ValidateNested() sharedToGroups: NoteGroupPermissionUpdateDto[];