mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-23 12:47:55 +00:00
changed dto name
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { HttpException, HttpStatus } from '@nestjs/common';
|
||||
import { CreateSpaceProductModelDto } from 'src/space-model/dtos';
|
||||
import { CreateProductModelDto } from '../../dtos';
|
||||
import { ProductService } from '../../../product/services';
|
||||
|
||||
export abstract class BaseProductModelService {
|
||||
constructor(private readonly productService: ProductService) {}
|
||||
|
||||
protected async validateProductCount(
|
||||
dto: CreateSpaceProductModelDto,
|
||||
dto: CreateProductModelDto,
|
||||
): Promise<void> {
|
||||
const productItemCount = dto.items.length;
|
||||
if (dto.productCount !== productItemCount) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNotEmpty, IsString, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { CreateSubspaceModelDto } from './subspaces-model-dtos/create-subspace-model.dto';
|
||||
import { CreateSpaceProductModelDto } from './create-space-product-model.dto';
|
||||
import { CreateProductModelDto } from './product-model-dtos';
|
||||
|
||||
export class CreateSpaceModelDto {
|
||||
@ApiProperty({
|
||||
@@ -24,10 +24,10 @@ export class CreateSpaceModelDto {
|
||||
|
||||
@ApiProperty({
|
||||
description: 'List of products included in the model',
|
||||
type: [CreateSpaceProductModelDto],
|
||||
type: [CreateProductModelDto],
|
||||
})
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateSpaceProductModelDto)
|
||||
spaceProductModels?: CreateSpaceProductModelDto[];
|
||||
@Type(() => CreateProductModelDto)
|
||||
spaceProductModels?: CreateProductModelDto[];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export * from './create-space-model.dto';
|
||||
export * from './create-space-product-item-model.dto';
|
||||
export * from './create-space-product-model.dto';
|
||||
export * from './product-model-dtos';
|
||||
export * from './project-param.dto';
|
||||
export * from './update-space-model.dto';
|
||||
export * from './space-model-param';
|
||||
|
||||
+4
-4
@@ -9,9 +9,9 @@ import {
|
||||
IsOptional,
|
||||
} from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { CreateProductItemModelDto } from './create-space-product-item-model.dto';
|
||||
import { CreateProductItemModelDto } from '../create-space-product-item-model.dto';
|
||||
|
||||
export class CreateSpaceProductModelDto {
|
||||
export class CreateProductModelDto {
|
||||
@ApiProperty({
|
||||
description: 'ID of the product associated with the model',
|
||||
example: 'product-uuid',
|
||||
@@ -81,11 +81,11 @@ export class ModifyProductModelDto {
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: 'Create the product model ',
|
||||
type: [CreateSpaceProductModelDto],
|
||||
type: [CreateProductModelDto],
|
||||
})
|
||||
@ValidateNested({ each: true })
|
||||
@IsOptional()
|
||||
add?: CreateSpaceProductModelDto[];
|
||||
add?: CreateProductModelDto[];
|
||||
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
@@ -0,0 +1 @@
|
||||
export * from './create-space-product-model.dto';
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { CreateSpaceProductModelDto } from '../create-space-product-model.dto';
|
||||
import { CreateProductModelDto } from '../product-model-dtos';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class CreateSubspaceModelDto {
|
||||
@@ -20,11 +20,11 @@ export class CreateSubspaceModelDto {
|
||||
|
||||
@ApiProperty({
|
||||
description: 'List of products included in the model',
|
||||
type: [CreateSpaceProductModelDto],
|
||||
type: [CreateProductModelDto],
|
||||
})
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateSpaceProductModelDto)
|
||||
spaceProductModels?: CreateSpaceProductModelDto[];
|
||||
@Type(() => CreateProductModelDto)
|
||||
spaceProductModels?: CreateProductModelDto[];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
IsOptional,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { CreateSpaceProductModelDto } from '../create-space-product-model.dto';
|
||||
import { CreateProductModelDto } from '../product-model-dtos';
|
||||
|
||||
export class UpdateSubspaceModelDto {
|
||||
@ApiProperty({
|
||||
@@ -24,11 +24,11 @@ export class UpdateSubspaceModelDto {
|
||||
|
||||
@ApiProperty({
|
||||
description: 'List of products included in the model',
|
||||
type: [CreateSpaceProductModelDto],
|
||||
type: [CreateProductModelDto],
|
||||
})
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateSpaceProductModelDto)
|
||||
spaceProductModels?: CreateSpaceProductModelDto[];
|
||||
@Type(() => CreateProductModelDto)
|
||||
spaceProductModels?: CreateProductModelDto[];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { QueryRunner } from 'typeorm';
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { CreateSpaceProductModelDto } from '../dtos';
|
||||
import { CreateProductModelDto } from '../dtos';
|
||||
import { SpaceProductItemModelService } from './space-product-item-model.service';
|
||||
import { BaseProductModelService } from '../common';
|
||||
import { ProductService } from 'src/product/services';
|
||||
@@ -20,7 +20,7 @@ export class SpaceProductModelService extends BaseProductModelService {
|
||||
}
|
||||
|
||||
async createSpaceProductModels(
|
||||
spaceProductModelDtos: CreateSpaceProductModelDto[],
|
||||
spaceProductModelDtos: CreateProductModelDto[],
|
||||
spaceModel: SpaceModelEntity,
|
||||
queryRunner: QueryRunner,
|
||||
) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from '@app/common/modules/space-model';
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { SubspaceProductItemModelService } from './subspace-product-item-model.service';
|
||||
import { CreateSpaceProductModelDto } from '../../dtos';
|
||||
import { CreateProductModelDto } from '../../dtos';
|
||||
import { QueryRunner } from 'typeorm';
|
||||
import { BaseProductModelService } from '../../common';
|
||||
import { ProductService } from 'src/product/services';
|
||||
@@ -21,7 +21,7 @@ export class SubspaceProductModelService extends BaseProductModelService {
|
||||
}
|
||||
|
||||
async createSubspaceProductModels(
|
||||
spaceProductModelDtos: CreateSpaceProductModelDto[],
|
||||
spaceProductModelDtos: CreateProductModelDto[],
|
||||
spaceModel: SpaceModelEntity,
|
||||
subspaceModel: SubspaceModelEntity,
|
||||
queryRunner: QueryRunner,
|
||||
|
||||
Reference in New Issue
Block a user