From bc1d4a62c640a892f5fc8c11b08e08c8e5dcbf46 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 4 Jan 2026 02:07:49 -0800 Subject: [PATCH] fix(authorization): add Transform decorator to parse includeRevoked query param MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 查询参数都是字符串类型,需要将 'true' 转换为布尔值 true, 否则后端无法正确处理 includeRevoked 参数,导致已撤销的授权记录不显示。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../src/api/dto/request/query-authorizations.dto.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/services/authorization-service/src/api/dto/request/query-authorizations.dto.ts b/backend/services/authorization-service/src/api/dto/request/query-authorizations.dto.ts index 4c6ca1cb..850507fd 100644 --- a/backend/services/authorization-service/src/api/dto/request/query-authorizations.dto.ts +++ b/backend/services/authorization-service/src/api/dto/request/query-authorizations.dto.ts @@ -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 })