fix(authorization): add Transform decorator to parse includeRevoked query param

查询参数都是字符串类型,需要将 'true' 转换为布尔值 true,
否则后端无法正确处理 includeRevoked 参数,导致已撤销的授权记录不显示。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-04 02:07:49 -08:00
parent c8f2d5edff
commit bc1d4a62c6
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { IsOptional, IsString, IsEnum, IsInt, Min, Max } from 'class-validator'
import { IsOptional, IsString, IsEnum, IsInt, Min, Max, IsBoolean } from 'class-validator'
import { ApiPropertyOptional } from '@nestjs/swagger'
import { Type } from 'class-transformer'
import { Type, Transform } from 'class-transformer'
import { RoleType } from '@/domain/enums'
export class QueryAuthorizationsDto {
@ -16,6 +16,8 @@ export class QueryAuthorizationsDto {
@ApiPropertyOptional({ description: '是否包含已撤销的授权', default: false })
@IsOptional()
@Transform(({ value }) => value === 'true' || value === true)
@IsBoolean()
includeRevoked?: boolean
@ApiPropertyOptional({ description: '页码', default: 1 })