Super-admins can assign Admin; owners/admins manage Editor/Viewer via team/access, and the customers list supports all/customers/managers filtering. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
456 B
TypeScript
18 lines
456 B
TypeScript
import { IsIn, IsOptional, IsString, Matches, ValidateIf } from 'class-validator';
|
|
import { ASSIGNABLE_TEAM_ROLES } from '../../auth/auth.types';
|
|
|
|
export class AssignTeamAccessDto {
|
|
@IsString()
|
|
@Matches(/^\d+$/)
|
|
userId!: string;
|
|
|
|
@IsString()
|
|
@IsIn(['customer', 'staff'])
|
|
access!: 'customer' | 'staff';
|
|
|
|
@ValidateIf((dto: AssignTeamAccessDto) => dto.access === 'staff')
|
|
@IsString()
|
|
@IsIn([...ASSIGNABLE_TEAM_ROLES])
|
|
roleSlug?: string;
|
|
}
|