Browse Source

Feature/improve validation for currency in endpoints (#3030)

* Improve validation for currency

* Update changelog
pull/3034/head
Thomas Kaul 11 months ago
committed by GitHub
parent
commit
40836b745b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 3
      apps/api/src/app/account/create-account.dto.ts
  3. 3
      apps/api/src/app/account/update-account.dto.ts
  4. 3
      apps/api/src/app/admin/update-asset-profile.dto.ts
  5. 3
      apps/api/src/app/order/create-order.dto.ts
  6. 3
      apps/api/src/app/order/update-order.dto.ts
  7. 3
      apps/api/src/app/user/update-user-setting.dto.ts

1
CHANGELOG.md

@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the validation for `currency` in various endpoints
- Harmonized the setting of a default locale in various components - Harmonized the setting of a default locale in various components
- Set the parser to `angular` in the `prettier` options - Set the parser to `angular` in the `prettier` options

3
apps/api/src/app/account/create-account.dto.ts

@ -1,6 +1,7 @@
import { Transform, TransformFnParams } from 'class-transformer'; import { Transform, TransformFnParams } from 'class-transformer';
import { import {
IsBoolean, IsBoolean,
IsISO4217CurrencyCode,
IsNumber, IsNumber,
IsOptional, IsOptional,
IsString, IsString,
@ -19,7 +20,7 @@ export class CreateAccountDto {
) )
comment?: string; comment?: string;
@IsString() @IsISO4217CurrencyCode()
currency: string; currency: string;
@IsOptional() @IsOptional()

3
apps/api/src/app/account/update-account.dto.ts

@ -1,6 +1,7 @@
import { Transform, TransformFnParams } from 'class-transformer'; import { Transform, TransformFnParams } from 'class-transformer';
import { import {
IsBoolean, IsBoolean,
IsISO4217CurrencyCode,
IsNumber, IsNumber,
IsOptional, IsOptional,
IsString, IsString,
@ -19,7 +20,7 @@ export class UpdateAccountDto {
) )
comment?: string; comment?: string;
@IsString() @IsISO4217CurrencyCode()
currency: string; currency: string;
@IsString() @IsString()

3
apps/api/src/app/admin/update-asset-profile.dto.ts

@ -2,6 +2,7 @@ import { AssetClass, AssetSubClass, Prisma } from '@prisma/client';
import { import {
IsArray, IsArray,
IsEnum, IsEnum,
IsISO4217CurrencyCode,
IsObject, IsObject,
IsOptional, IsOptional,
IsString IsString
@ -24,7 +25,7 @@ export class UpdateAssetProfileDto {
@IsOptional() @IsOptional()
countries?: Prisma.InputJsonArray; countries?: Prisma.InputJsonArray;
@IsString() @IsISO4217CurrencyCode()
@IsOptional() @IsOptional()
currency?: string; currency?: string;

3
apps/api/src/app/order/create-order.dto.ts

@ -10,6 +10,7 @@ import {
IsArray, IsArray,
IsBoolean, IsBoolean,
IsEnum, IsEnum,
IsISO4217CurrencyCode,
IsISO8601, IsISO8601,
IsNumber, IsNumber,
IsOptional, IsOptional,
@ -38,7 +39,7 @@ export class CreateOrderDto {
) )
comment?: string; comment?: string;
@IsString() @IsISO4217CurrencyCode()
currency: string; currency: string;
@IsOptional() @IsOptional()

3
apps/api/src/app/order/update-order.dto.ts

@ -9,6 +9,7 @@ import { Transform, TransformFnParams } from 'class-transformer';
import { import {
IsArray, IsArray,
IsEnum, IsEnum,
IsISO4217CurrencyCode,
IsISO8601, IsISO8601,
IsNumber, IsNumber,
IsOptional, IsOptional,
@ -37,7 +38,7 @@ export class UpdateOrderDto {
) )
comment?: string; comment?: string;
@IsString() @IsISO4217CurrencyCode()
currency: string; currency: string;
@IsString() @IsString()

3
apps/api/src/app/user/update-user-setting.dto.ts

@ -7,6 +7,7 @@ import type {
import { import {
IsArray, IsArray,
IsBoolean, IsBoolean,
IsISO4217CurrencyCode,
IsISO8601, IsISO8601,
IsIn, IsIn,
IsNumber, IsNumber,
@ -19,8 +20,8 @@ export class UpdateUserSettingDto {
@IsOptional() @IsOptional()
annualInterestRate?: number; annualInterestRate?: number;
@IsISO4217CurrencyCode()
@IsOptional() @IsOptional()
@IsString()
baseCurrency?: string; baseCurrency?: string;
@IsString() @IsString()

Loading…
Cancel
Save