added more security check rules in dtos

This commit is contained in:
Kevsl
2024-06-11 09:52:47 +02:00
parent 1171e5e13c
commit 0ba8b52be3
7 changed files with 82 additions and 7 deletions

View File

@@ -1,12 +1,22 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNumber, IsPositive, IsString } from 'class-validator';
import {
IsNumber,
IsPositive,
IsString,
IsUUID,
Max,
MaxLength,
Min,
} from 'class-validator';
export class OfferDto {
@ApiProperty({
type: String,
description: 'Cryptocurrency UUID',
example: '12121-DSZD-E221212-2121221',
})
@MaxLength(50)
@IsString()
@IsUUID()
id_crypto: string;
@ApiProperty({
@@ -15,6 +25,8 @@ export class OfferDto {
description: 'Amount traded ',
example: 21,
})
@Min(1)
@Max(1000)
@IsNumber()
@IsPositive()
amount: number;