mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-13 08:44:48 +00:00
39 lines
893 B
TypeScript
39 lines
893 B
TypeScript
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[];
|
|
}
|