feat: api key dto docs

This commit is contained in:
Ahmed Bouhuolia
2025-07-06 10:44:32 +02:00
parent 456a9e1ad9
commit cd1a70ca94
2 changed files with 97 additions and 2 deletions

View File

@@ -0,0 +1,52 @@
import { ApiProperty } from '@nestjs/swagger';
export class ApiKeyResponseDto {
@ApiProperty({ example: 1, description: 'API key ID' })
id: number;
@ApiProperty({
example: 'bc_1234567890abcdef',
description: 'The API key string',
})
key: string;
}
export class ApiKeyRevokeResponseDto {
@ApiProperty({ example: 1, description: 'API key ID' })
id: number;
@ApiProperty({
example: true,
description: 'Whether the API key was revoked',
})
revoked: boolean;
}
export class ApiKeyListItemDto {
@ApiProperty({ example: 1, description: 'API key ID' })
id: number;
@ApiProperty({ example: 'My API Key', description: 'API key name' })
name?: string;
@ApiProperty({
example: '2024-01-01T00:00:00.000Z',
description: 'Creation date',
})
createdAt: Date;
@ApiProperty({
example: '2024-12-31T23:59:59.000Z',
required: false,
description: 'Expiration date',
})
expiresAt?: Date;
@ApiProperty({ example: false, description: 'Whether the key is revoked' })
revoked: boolean;
}
export class ApiKeyListResponseDto {
@ApiProperty({ type: [ApiKeyListItemDto] })
data: ApiKeyListItemDto[];
}