import { ApiProperty } from '@nestjs/swagger'; import { IsArray, IsNumber } from 'class-validator'; export class PermissionDto { @ApiProperty({ type: Number }) id: number; @ApiProperty({ type: String }) name: string; } export class ApiKeyBaseResponseDto { @ApiProperty({ type: String, format: 'uuid' }) id: string; @ApiProperty({ type: String }) key_mask: string; @ApiProperty({ type: [PermissionDto] }) permissions: PermissionDto[]; @ApiProperty({ type: String, format: 'date-time' }) created_at: string; @ApiProperty({ type: String }) created_by: string; } export class CreateApiKeyResponseDto extends ApiKeyBaseResponseDto { @ApiProperty({ type: String }) key: string; } export class CreateApiKeyDto { @ApiProperty({ type: [Number], description: 'Array of permission IDs' }) @IsArray() @IsNumber({}, { each: true }) permissions: number[]; }