brief-07-back/src/crypto/dto/crypto.dto.ts
2024-06-11 09:52:47 +02:00

55 lines
929 B
TypeScript

import { ApiProperty } from '@nestjs/swagger';
import {
IsNumber,
IsPositive,
IsString,
IsUrl,
Max,
MaxLength,
Min,
MinLength,
} from 'class-validator';
export class CryptoDto {
@ApiProperty({
type: String,
description: 'Cryptocurrency name',
example: 'BTC',
})
@MaxLength(50)
@MinLength(1)
@IsString()
name: string;
@ApiProperty({
type: Number,
description: 'Value for the cryptocurrency in $',
example: 1,
})
@Min(1)
@Max(10000)
@IsPositive()
@IsNumber()
value: number;
@ApiProperty({
type: Number,
description: 'Quantity of tokens available on the platform',
example: 100,
})
@Min(1)
@Max(10000)
@IsPositive()
@IsNumber()
quantity: number;
@ApiProperty({
type: String,
description: 'Image for the cryptocurrency in ',
example: 'https://myImage/com',
})
@MaxLength(255)
@IsUrl()
@IsString()
image: string;
}