2020-07-26 14:58:40 -04:00
|
|
|
import { IsArray, IsBoolean, IsString, ValidateNested } from 'class-validator';
|
2020-07-25 14:24:59 -04:00
|
|
|
import { UserInfoDto } from '../users/user-info.dto';
|
|
|
|
|
2020-07-26 16:34:04 -04:00
|
|
|
export class NoteUserPermissionEntryDto {
|
2020-07-25 14:24:59 -04:00
|
|
|
@ValidateNested()
|
|
|
|
user: UserInfoDto;
|
|
|
|
@IsBoolean()
|
|
|
|
canEdit: boolean;
|
|
|
|
}
|
|
|
|
|
2020-07-26 14:58:40 -04:00
|
|
|
export class NotePermissionEntryUpdateDto {
|
|
|
|
@IsString()
|
|
|
|
username: string;
|
|
|
|
@IsBoolean()
|
|
|
|
canEdit: boolean;
|
|
|
|
}
|
|
|
|
|
2020-07-26 16:34:04 -04:00
|
|
|
export class GroupInfoDto {
|
|
|
|
@IsString()
|
|
|
|
id: string
|
|
|
|
@IsString()
|
|
|
|
displayName: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export class NoteGroupPermissionEntryDto {
|
|
|
|
@ValidateNested()
|
|
|
|
group: GroupInfoDto
|
|
|
|
@IsBoolean()
|
|
|
|
canEdit: boolean
|
|
|
|
}
|
|
|
|
|
2020-07-25 14:24:59 -04:00
|
|
|
export class NotePermissionsDto {
|
|
|
|
@ValidateNested()
|
|
|
|
owner: UserInfoDto;
|
|
|
|
@ValidateNested()
|
|
|
|
@IsArray()
|
2020-07-26 16:34:04 -04:00
|
|
|
sharedToUsers: NoteUserPermissionEntryDto[];
|
|
|
|
@ValidateNested()
|
|
|
|
@IsArray()
|
|
|
|
sharedToGroups: NoteGroupPermissionEntryDto[];
|
2020-07-25 14:24:59 -04:00
|
|
|
}
|
2020-07-26 14:58:40 -04:00
|
|
|
|
|
|
|
export class NotePermissionsUpdateDto {
|
|
|
|
@IsArray()
|
|
|
|
@ValidateNested()
|
|
|
|
sharedTo: NotePermissionEntryUpdateDto[];
|
|
|
|
}
|