- 平台管理员模型:super_admin=平台超管、tenant_super_admin=租户顶层(保留码),tenant:* 仅平台可授予 - 软删改名回收唯一键 + P2002→409 - 删除角色级联清理关联 + 聚合过滤已删/停用角色资源 - tokenVersion 会话吊销(重置密码/停用/删除即时踢下线) - data_scope self 按 userId 过滤 + 详情数据权限校验 - 组织树防环、seed 不重置密码、日志脱敏补 phone/email - JWT 密钥强校验、pageSize 上限、DTO 枚举校验、Prisma 错误映射、授权事务化 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||
import { IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||
import { CommonStatus } from '../common/enums.js';
|
||
|
||
export class CreateOrgDto {
|
||
@ApiProperty({ description: '组织 code(租户内唯一)' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
code!: string;
|
||
|
||
@ApiProperty({ description: '组织名称' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
name!: string;
|
||
|
||
@ApiPropertyOptional({ description: '父组织 code' })
|
||
@IsOptional()
|
||
@IsString()
|
||
parentCode?: string;
|
||
|
||
@ApiPropertyOptional({ description: '负责人' })
|
||
@IsOptional()
|
||
@IsString()
|
||
leader?: string;
|
||
|
||
@ApiPropertyOptional({ description: '排序', default: 0 })
|
||
@IsOptional()
|
||
@IsInt()
|
||
sort?: number;
|
||
}
|
||
|
||
export class UpdateOrgDto {
|
||
@ApiPropertyOptional({ description: '组织名称' })
|
||
@IsOptional()
|
||
@IsString()
|
||
name?: string;
|
||
|
||
@ApiPropertyOptional({ description: '父组织 code' })
|
||
@IsOptional()
|
||
@IsString()
|
||
parentCode?: string;
|
||
|
||
@ApiPropertyOptional({ description: '负责人' })
|
||
@IsOptional()
|
||
@IsString()
|
||
leader?: string;
|
||
|
||
@ApiPropertyOptional({ description: '排序' })
|
||
@IsOptional()
|
||
@IsInt()
|
||
sort?: number;
|
||
|
||
@ApiPropertyOptional({ description: '状态:enabled/disabled' })
|
||
@IsOptional()
|
||
@IsIn(Object.values(CommonStatus))
|
||
status?: string;
|
||
}
|