mirror of
https://github.com/docmost/docmost.git
synced 2025-11-24 02:11:31 +10:00
Work on groups
* add batch group member insertion * allow adding members on group creation * fixes
This commit is contained in:
@ -1,8 +1,16 @@
|
||||
import { IsNotEmpty, IsUUID } from 'class-validator';
|
||||
import { ArrayMaxSize, ArrayMinSize, IsArray, IsUUID } from 'class-validator';
|
||||
import { GroupIdDto } from './group-id.dto';
|
||||
|
||||
export class AddGroupUserDto extends GroupIdDto {
|
||||
@IsNotEmpty()
|
||||
@IsUUID()
|
||||
userId: string;
|
||||
// @IsOptional()
|
||||
// @IsUUID()
|
||||
// userId: string;
|
||||
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50, {
|
||||
message: 'userIds must an array with no more than 50 elements',
|
||||
})
|
||||
@ArrayMinSize(1)
|
||||
@IsUUID(4, { each: true })
|
||||
userIds: string[];
|
||||
}
|
||||
|
||||
@ -1,16 +1,31 @@
|
||||
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
|
||||
import {
|
||||
ArrayMaxSize,
|
||||
IsArray,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateGroupDto {
|
||||
@MinLength(2)
|
||||
@MaxLength(64)
|
||||
@MaxLength(50)
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@IsUUID(4, { each: true })
|
||||
userIds?: string[];
|
||||
}
|
||||
|
||||
export enum DefaultGroup {
|
||||
EVERYONE = 'internal_users',
|
||||
EVERYONE = 'Everyone',
|
||||
DESCRIPTION = 'Group for all users in this workspace.',
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
import { AddGroupUserDto } from './add-group-user.dto';
|
||||
import { GroupIdDto } from './group-id.dto';
|
||||
import { IsUUID } from 'class-validator';
|
||||
|
||||
export class RemoveGroupUserDto extends AddGroupUserDto {}
|
||||
export class RemoveGroupUserDto extends GroupIdDto {
|
||||
@IsUUID()
|
||||
userId: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user