From ea217b3613207ad0726e553fc2f98345971d8ae8 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 26 Jul 2020 22:34:04 +0200 Subject: [PATCH] Adapt permission DTOs for group permissions Signed-off-by: David Mehren --- src/notes/note-permissions.dto.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/notes/note-permissions.dto.ts b/src/notes/note-permissions.dto.ts index ad57c1a77..4f35fe169 100644 --- a/src/notes/note-permissions.dto.ts +++ b/src/notes/note-permissions.dto.ts @@ -1,7 +1,7 @@ import { IsArray, IsBoolean, IsString, ValidateNested } from 'class-validator'; import { UserInfoDto } from '../users/user-info.dto'; -export class NotePermissionEntryDto { +export class NoteUserPermissionEntryDto { @ValidateNested() user: UserInfoDto; @IsBoolean() @@ -15,12 +15,29 @@ export class NotePermissionEntryUpdateDto { canEdit: boolean; } +export class GroupInfoDto { + @IsString() + id: string + @IsString() + displayName: string +} + +export class NoteGroupPermissionEntryDto { + @ValidateNested() + group: GroupInfoDto + @IsBoolean() + canEdit: boolean +} + export class NotePermissionsDto { @ValidateNested() owner: UserInfoDto; @ValidateNested() @IsArray() - sharedTo: NotePermissionEntryDto[]; + sharedToUsers: NoteUserPermissionEntryDto[]; + @ValidateNested() + @IsArray() + sharedToGroups: NoteGroupPermissionEntryDto[]; } export class NotePermissionsUpdateDto {