From 039b8dcdc00a3472ffdaa5768dd1098cbbaa7b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20G=C3=B3mez?= Date: Sun, 14 Apr 2024 18:37:08 +0200 Subject: [PATCH] Allow fractional shares (#445) * Allow fractional shares * Allow fractional shares --- src/portfolios/domain/dto/test/upsert-position-dto.factory.ts | 4 ++-- src/portfolios/routes/dto/upsert-position.dto.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/portfolios/domain/dto/test/upsert-position-dto.factory.ts b/src/portfolios/domain/dto/test/upsert-position-dto.factory.ts index b2b4dabc..18e53bc3 100644 --- a/src/portfolios/domain/dto/test/upsert-position-dto.factory.ts +++ b/src/portfolios/domain/dto/test/upsert-position-dto.factory.ts @@ -9,8 +9,8 @@ export function upsertPositionDtoFactory( ): UpsertPositionDto { return { symbol: symbol ?? faker.word.words(), - targetWeight: targetWeight ?? faker.number.int({ min: 5, max: 10 }), - shares: shares ?? faker.number.int({ min: 10, max: 100 }), + targetWeight: targetWeight ?? faker.number.float({ min: 5, max: 10 }), + shares: shares ?? faker.number.float({ min: 10, max: 100 }), blocked: blocked ?? faker.datatype.boolean(), }; } diff --git a/src/portfolios/routes/dto/upsert-position.dto.ts b/src/portfolios/routes/dto/upsert-position.dto.ts index 3268593c..87556314 100644 --- a/src/portfolios/routes/dto/upsert-position.dto.ts +++ b/src/portfolios/routes/dto/upsert-position.dto.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsBoolean, IsInt, IsPositive, IsString } from 'class-validator'; +import { IsBoolean, IsPositive, IsString } from 'class-validator'; import { UpsertPositionDto as DomainUpsertPositionDto } from '../../domain/dto/upsert-position.dto'; export class UpsertPositionDto implements DomainUpsertPositionDto { @@ -10,7 +10,7 @@ export class UpsertPositionDto implements DomainUpsertPositionDto { @IsPositive() targetWeight: number; @ApiProperty() - @IsInt() + @IsPositive() shares: number; @ApiProperty() @IsBoolean()