File

src/auth/dto/create-api-key.dto.ts

Index

Properties

Properties

Optional expiresAt
Type : string
Decorators :
@ApiPropertyOptional({example: '2027-01-01T00:00:00.000Z', description: 'Optional expiration date'})
@IsOptional()
@IsDateString()
name
Type : string
Decorators :
@ApiProperty({example: 'ERP Integration', description: 'Human-readable name for this API key'})
@IsString()
permissions
Type : string[]
Decorators :
@ApiProperty({example: undefined, description: 'Permission scopes granted to this key'})
@IsArray()
@ArrayNotEmpty()
@IsString({each: true})
import { IsString, IsArray, IsOptional, IsDateString, ArrayNotEmpty } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateApiKeyDto {
  @ApiProperty({ example: 'ERP Integration', description: 'Human-readable name for this API key' })
  @IsString()
  name: string;

  @ApiProperty({
    example: ['orders:read', 'orders:write', 'vehicles:read'],
    description: 'Permission scopes granted to this key',
  })
  @IsArray()
  @ArrayNotEmpty()
  @IsString({ each: true })
  permissions: string[];

  @ApiPropertyOptional({ example: '2027-01-01T00:00:00.000Z', description: 'Optional expiration date' })
  @IsOptional()
  @IsDateString()
  expiresAt?: string;
}

results matching ""

    No results matching ""