mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
defined product model dto
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
export * from './create-space-model.dto';
|
export * from './create-space-model.dto';
|
||||||
export * from './create-space-product-item-model.dto';
|
export * from './product-item-model-dtos';
|
||||||
export * from './product-model-dtos';
|
export * from './product-model-dtos';
|
||||||
export * from './project-param.dto';
|
export * from './project-param.dto';
|
||||||
export * from './update-space-model.dto';
|
export * from './update-space-model.dto';
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
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;
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
import { BaseProductItemModelDto } from './base-product-item-model.dto';
|
||||||
|
|
||||||
|
export class DeleteProductItemModelDto extends BaseProductItemModelDto {}
|
4
src/space-model/dtos/product-item-model-dtos/index.ts
Normal file
4
src/space-model/dtos/product-item-model-dtos/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
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'
|
@ -0,0 +1,34 @@
|
|||||||
|
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[];
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
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;
|
||||||
|
}
|
@ -8,7 +8,7 @@ import {
|
|||||||
ArrayNotEmpty,
|
ArrayNotEmpty,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
import { CreateProductItemModelDto } from '../create-space-product-item-model.dto';
|
import { CreateProductItemModelDto } from '../product-item-model-dtos/create-product-item-model.dto';
|
||||||
|
|
||||||
export class CreateProductModelDto {
|
export class CreateProductModelDto {
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
|
@ -2,14 +2,13 @@ import { ApiProperty } from '@nestjs/swagger';
|
|||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
import {
|
import {
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsString,
|
|
||||||
IsInt,
|
IsInt,
|
||||||
IsArray,
|
IsArray,
|
||||||
ArrayNotEmpty,
|
ArrayNotEmpty,
|
||||||
ValidateNested,
|
ValidateNested,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
import { CreateProductItemModelDto } from '../create-space-product-item-model.dto';
|
|
||||||
import { BaseProductModelDto } from './base-product-model.dto';
|
import { BaseProductModelDto } from './base-product-model.dto';
|
||||||
|
import { ProductItemModelModificationDto } from '../product-item-model-dtos';
|
||||||
|
|
||||||
export class UpdateProductModelDto extends BaseProductModelDto {
|
export class UpdateProductModelDto extends BaseProductModelDto {
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
@ -21,12 +20,12 @@ export class UpdateProductModelDto extends BaseProductModelDto {
|
|||||||
productCount: number;
|
productCount: number;
|
||||||
|
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'Specific names for each product item',
|
description: 'Update product item',
|
||||||
type: [CreateProductItemModelDto],
|
type: [ProductItemModelModificationDto],
|
||||||
})
|
})
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@ArrayNotEmpty()
|
@ArrayNotEmpty()
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@Type(() => CreateProductItemModelDto)
|
@Type(() => ProductItemModelModificationDto)
|
||||||
items: CreateProductItemModelDto[];
|
items: ProductItemModelModificationDto[];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user