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:
parent
c8f2d5edff
commit
bc1d4a62c6
|
|
@ -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 { ApiPropertyOptional } from '@nestjs/swagger'
|
||||||
import { Type } from 'class-transformer'
|
import { Type, Transform } from 'class-transformer'
|
||||||
import { RoleType } from '@/domain/enums'
|
import { RoleType } from '@/domain/enums'
|
||||||
|
|
||||||
export class QueryAuthorizationsDto {
|
export class QueryAuthorizationsDto {
|
||||||
|
|
@ -16,6 +16,8 @@ export class QueryAuthorizationsDto {
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: '是否包含已撤销的授权', default: false })
|
@ApiPropertyOptional({ description: '是否包含已撤销的授权', default: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
@Transform(({ value }) => value === 'true' || value === true)
|
||||||
|
@IsBoolean()
|
||||||
includeRevoked?: boolean
|
includeRevoked?: boolean
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: '页码', default: 1 })
|
@ApiPropertyOptional({ description: '页码', default: 1 })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue