From 4545b2e84cc8b958957a12dbbd1f7aea7c2e4363 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 23 Dec 2024 08:49:07 +0400 Subject: [PATCH] dto clean up --- .../base-product-item-model.dto.ts | 12 ------- .../create-product-item-model.dto.ts | 12 ------- .../delete-product-item-model.dto.ts | 3 -- .../dtos/product-item-model-dtos/index.ts | 4 --- .../product-item-model-modification.ts | 34 ------------------- .../update-prodct-item-model.dto.ts | 13 ------- .../base-product-model.dto.ts | 12 ------- .../create-product-model.dto.ts | 30 ---------------- .../delete-product-model.dto.ts | 3 -- .../dtos/product-model-dtos/index.ts | 4 --- .../product-model-modification.dto.ts | 34 ------------------- .../update-product-model.dto.ts | 17 ---------- .../update-subspace-model.dto.ts | 19 +---------- 13 files changed, 1 insertion(+), 196 deletions(-) delete mode 100644 src/space-model/dtos/product-item-model-dtos/base-product-item-model.dto.ts delete mode 100644 src/space-model/dtos/product-item-model-dtos/create-product-item-model.dto.ts delete mode 100644 src/space-model/dtos/product-item-model-dtos/delete-product-item-model.dto.ts delete mode 100644 src/space-model/dtos/product-item-model-dtos/index.ts delete mode 100644 src/space-model/dtos/product-item-model-dtos/product-item-model-modification.ts delete mode 100644 src/space-model/dtos/product-item-model-dtos/update-prodct-item-model.dto.ts delete mode 100644 src/space-model/dtos/product-model-dtos/base-product-model.dto.ts delete mode 100644 src/space-model/dtos/product-model-dtos/create-product-model.dto.ts delete mode 100644 src/space-model/dtos/product-model-dtos/delete-product-model.dto.ts delete mode 100644 src/space-model/dtos/product-model-dtos/index.ts delete mode 100644 src/space-model/dtos/product-model-dtos/product-model-modification.dto.ts delete mode 100644 src/space-model/dtos/product-model-dtos/update-product-model.dto.ts diff --git a/src/space-model/dtos/product-item-model-dtos/base-product-item-model.dto.ts b/src/space-model/dtos/product-item-model-dtos/base-product-item-model.dto.ts deleted file mode 100644 index dc01713..0000000 --- a/src/space-model/dtos/product-item-model-dtos/base-product-item-model.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty, IsString } from 'class-validator'; - -export class BaseProductItemModelDto { - @ApiProperty({ - description: 'ID of the product item model', - example: 'product-item-uuid', - }) - @IsNotEmpty() - @IsString() - productModelUuid: string; -} diff --git a/src/space-model/dtos/product-item-model-dtos/create-product-item-model.dto.ts b/src/space-model/dtos/product-item-model-dtos/create-product-item-model.dto.ts deleted file mode 100644 index e6a7e76..0000000 --- a/src/space-model/dtos/product-item-model-dtos/create-product-item-model.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty, IsString } from 'class-validator'; - -export class CreateProductItemModelDto { - @ApiProperty({ - description: 'Specific name for the product item', - example: 'Light 1', - }) - @IsNotEmpty() - @IsString() - tag: string; -} diff --git a/src/space-model/dtos/product-item-model-dtos/delete-product-item-model.dto.ts b/src/space-model/dtos/product-item-model-dtos/delete-product-item-model.dto.ts deleted file mode 100644 index 971a0d0..0000000 --- a/src/space-model/dtos/product-item-model-dtos/delete-product-item-model.dto.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { BaseProductItemModelDto } from './base-product-item-model.dto'; - -export class DeleteProductItemModelDto extends BaseProductItemModelDto {} diff --git a/src/space-model/dtos/product-item-model-dtos/index.ts b/src/space-model/dtos/product-item-model-dtos/index.ts deleted file mode 100644 index 5225122..0000000 --- a/src/space-model/dtos/product-item-model-dtos/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './create-product-item-model.dto'; -export * from './update-prodct-item-model.dto'; -export * from './delete-product-item-model.dto'; -export * from './product-item-model-modification' \ No newline at end of file diff --git a/src/space-model/dtos/product-item-model-dtos/product-item-model-modification.ts b/src/space-model/dtos/product-item-model-dtos/product-item-model-modification.ts deleted file mode 100644 index 04ca2d6..0000000 --- a/src/space-model/dtos/product-item-model-dtos/product-item-model-modification.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsArray, ValidateNested, IsOptional } from 'class-validator'; - -import { CreateProductItemModelDto } from './create-product-item-model.dto'; -import { UpdateProductItemModelDto } from './update-prodct-item-model.dto'; -import { DeleteProductItemModelDto } from './delete-product-item-model.dto'; - -export class ProductItemModelModificationDto { - @IsArray() - @ApiProperty({ - description: 'Create the product item model ', - type: [CreateProductItemModelDto], - }) - @ValidateNested({ each: true }) - @IsOptional() - add?: CreateProductItemModelDto[]; - - @IsArray() - @ApiProperty({ - description: 'Update the product item model ', - type: [UpdateProductItemModelDto], - }) - @ValidateNested({ each: true }) - @IsOptional() - update?: UpdateProductItemModelDto[]; - - @IsArray() - @ApiProperty({ - description: 'Delete the product item model ', - type: [DeleteProductItemModelDto], - }) - @IsOptional() - delete?: DeleteProductItemModelDto[]; -} diff --git a/src/space-model/dtos/product-item-model-dtos/update-prodct-item-model.dto.ts b/src/space-model/dtos/product-item-model-dtos/update-prodct-item-model.dto.ts deleted file mode 100644 index ef88432..0000000 --- a/src/space-model/dtos/product-item-model-dtos/update-prodct-item-model.dto.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty, IsString } from 'class-validator'; -import { BaseProductItemModelDto } from './base-product-item-model.dto'; - -export class UpdateProductItemModelDto extends BaseProductItemModelDto { - @ApiProperty({ - description: 'Specific name for the product item', - example: 'Light 1', - }) - @IsNotEmpty() - @IsString() - tag: string; -} diff --git a/src/space-model/dtos/product-model-dtos/base-product-model.dto.ts b/src/space-model/dtos/product-model-dtos/base-product-model.dto.ts deleted file mode 100644 index 4a27559..0000000 --- a/src/space-model/dtos/product-model-dtos/base-product-model.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty, IsString } from 'class-validator'; - -export class BaseProductModelDto { - @ApiProperty({ - description: 'ID of the product model', - example: 'product-uuid', - }) - @IsNotEmpty() - @IsString() - productModelUuid: string; -} diff --git a/src/space-model/dtos/product-model-dtos/create-product-model.dto.ts b/src/space-model/dtos/product-model-dtos/create-product-model.dto.ts deleted file mode 100644 index b40e9d7..0000000 --- a/src/space-model/dtos/product-model-dtos/create-product-model.dto.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { - IsNotEmpty, - IsString, - IsArray, - ValidateNested, - ArrayNotEmpty, -} from 'class-validator'; -import { Type } from 'class-transformer'; -import { CreateProductItemModelDto } from '../product-item-model-dtos/create-product-item-model.dto'; - -export class CreateProductModelDto { - @ApiProperty({ - description: 'ID of the product associated with the model', - example: 'product-uuid', - }) - @IsNotEmpty() - @IsString() - productUuid: string; - - @ApiProperty({ - description: 'Specific names for each product item', - type: [CreateProductItemModelDto], - }) - @IsArray() - @ArrayNotEmpty() - @ValidateNested({ each: true }) - @Type(() => CreateProductItemModelDto) - items: CreateProductItemModelDto[]; -} diff --git a/src/space-model/dtos/product-model-dtos/delete-product-model.dto.ts b/src/space-model/dtos/product-model-dtos/delete-product-model.dto.ts deleted file mode 100644 index 5653c8d..0000000 --- a/src/space-model/dtos/product-model-dtos/delete-product-model.dto.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { BaseProductModelDto } from './base-product-model.dto'; - -export class DeleteProductModelDto extends BaseProductModelDto {} diff --git a/src/space-model/dtos/product-model-dtos/index.ts b/src/space-model/dtos/product-model-dtos/index.ts deleted file mode 100644 index b2dbd90..0000000 --- a/src/space-model/dtos/product-model-dtos/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './create-product-model.dto'; -export * from './delete-product-model.dto'; -export * from './update-product-model.dto'; -export * from './product-model-modification.dto'; diff --git a/src/space-model/dtos/product-model-dtos/product-model-modification.dto.ts b/src/space-model/dtos/product-model-dtos/product-model-modification.dto.ts deleted file mode 100644 index 8bf9133..0000000 --- a/src/space-model/dtos/product-model-dtos/product-model-modification.dto.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsArray, ValidateNested, IsOptional } from 'class-validator'; - -import { CreateProductModelDto } from './create-product-model.dto'; -import { DeleteProductModelDto } from './delete-product-model.dto'; -import { UpdateProductModelDto } from './update-product-model.dto'; - -export class ProductModelModificationDto { - @IsArray() - @ApiProperty({ - description: 'Create the product model ', - type: [CreateProductModelDto], - }) - @ValidateNested({ each: true }) - @IsOptional() - add?: CreateProductModelDto[]; - - @IsArray() - @ApiProperty({ - description: 'Update the product model ', - type: [UpdateProductModelDto], - }) - @ValidateNested({ each: true }) - @IsOptional() - update?: UpdateProductModelDto[]; - - @IsArray() - @ApiProperty({ - description: 'Delete the product model ', - type: [DeleteProductModelDto], - }) - @IsOptional() - delete?: DeleteProductModelDto[]; -} diff --git a/src/space-model/dtos/product-model-dtos/update-product-model.dto.ts b/src/space-model/dtos/product-model-dtos/update-product-model.dto.ts deleted file mode 100644 index 9310b46..0000000 --- a/src/space-model/dtos/product-model-dtos/update-product-model.dto.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; -import { IsArray, ArrayNotEmpty, ValidateNested } from 'class-validator'; -import { BaseProductModelDto } from './base-product-model.dto'; -import { ProductItemModelModificationDto } from '../product-item-model-dtos'; - -export class UpdateProductModelDto extends BaseProductModelDto { - @ApiProperty({ - description: 'Update product item', - type: [ProductItemModelModificationDto], - }) - @IsArray() - @ArrayNotEmpty() - @ValidateNested({ each: true }) - @Type(() => ProductItemModelModificationDto) - items: ProductItemModelModificationDto; -} diff --git a/src/space-model/dtos/subspaces-model-dtos/update-subspace-model.dto.ts b/src/space-model/dtos/subspaces-model-dtos/update-subspace-model.dto.ts index 93ca12b..a386f4e 100644 --- a/src/space-model/dtos/subspaces-model-dtos/update-subspace-model.dto.ts +++ b/src/space-model/dtos/subspaces-model-dtos/update-subspace-model.dto.ts @@ -1,13 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; -import { - IsNotEmpty, - IsString, - IsArray, - IsOptional, - ValidateNested, -} from 'class-validator'; -import { ProductModelModificationDto } from '../product-model-dtos'; +import { IsNotEmpty, IsString } from 'class-validator'; export class UpdateSubspaceModelDto { @ApiProperty({ @@ -21,13 +13,4 @@ export class UpdateSubspaceModelDto { @IsNotEmpty() @IsString() subspaceUuid: string; - - @ApiProperty({ - description: 'Products models modified in the model', - type: ProductModelModificationDto, - }) - @IsOptional() - @ValidateNested({ each: true }) - @Type(() => ProductModelModificationDto) - updatedProductModels?: ProductModelModificationDto; }