Adapt permission DTOs for group permissions

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-07-26 22:34:04 +02:00
parent 34d0578c0d
commit d1bd35007e
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -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 {