fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Expose, Type } from 'class-transformer';
|
import { Expose, Type, Transform } from 'class-transformer';
|
||||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
|
||||||
export class CategoryInProductResponseDto {
|
export class CategoryInProductResponseDto {
|
||||||
@@ -38,6 +38,7 @@ export class ProductResponseDto {
|
|||||||
|
|
||||||
@ApiProperty({ description: 'Product price' })
|
@ApiProperty({ description: 'Product price' })
|
||||||
@Expose()
|
@Expose()
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
price: number;
|
price: number;
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: 'Product image URL' })
|
@ApiPropertyOptional({ description: 'Product image URL' })
|
||||||
@@ -50,6 +51,7 @@ export class ProductResponseDto {
|
|||||||
|
|
||||||
@ApiProperty({ description: 'Stock quantity' })
|
@ApiProperty({ description: 'Stock quantity' })
|
||||||
@Expose()
|
@Expose()
|
||||||
|
@Transform(({ value }) => parseInt(value, 10))
|
||||||
stockQuantity: number;
|
stockQuantity: number;
|
||||||
|
|
||||||
@ApiProperty({ description: 'Availability status' })
|
@ApiProperty({ description: 'Availability status' })
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Exclude, Expose, Type } from 'class-transformer';
|
import { Exclude, Expose, Type, Transform } from 'class-transformer';
|
||||||
|
|
||||||
@Exclude()
|
@Exclude()
|
||||||
export class TransactionItemResponseDto {
|
export class TransactionItemResponseDto {
|
||||||
@@ -17,14 +17,17 @@ export class TransactionItemResponseDto {
|
|||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Product price at transaction time' })
|
@ApiProperty({ description: 'Product price at transaction time' })
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
price: number;
|
price: number;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Quantity purchased' })
|
@ApiProperty({ description: 'Quantity purchased' })
|
||||||
|
@Transform(({ value }) => parseInt(value, 10))
|
||||||
quantity: number;
|
quantity: number;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Line total (price * quantity)' })
|
@ApiProperty({ description: 'Line total (price * quantity)' })
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
lineTotal: number;
|
lineTotal: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,18 +39,22 @@ export class TransactionResponseDto {
|
|||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Subtotal before tax and discount' })
|
@ApiProperty({ description: 'Subtotal before tax and discount' })
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
subtotal: number;
|
subtotal: number;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Tax amount' })
|
@ApiProperty({ description: 'Tax amount' })
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
tax: number;
|
tax: number;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Discount amount' })
|
@ApiProperty({ description: 'Discount amount' })
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
discount: number;
|
discount: number;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@ApiProperty({ description: 'Total amount (subtotal + tax - discount)' })
|
@ApiProperty({ description: 'Total amount (subtotal + tax - discount)' })
|
||||||
|
@Transform(({ value }) => parseFloat(value))
|
||||||
total: number;
|
total: number;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
|
|||||||
Reference in New Issue
Block a user