From 62f949396f1e533ecbb733caba0d46ed9fb12174 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 11 Feb 2025 11:23:29 +0400 Subject: [PATCH] removed allowed quantity and renamed tags --- .../space-model/dtos/space-model-product-allocation.dto.ts | 5 +---- .../subspace-model/subspace-model-product-allocation.dto.ts | 5 +---- .../entities/space-model-product-allocation.entity.ts | 5 +---- .../subspace-model-product-allocation.entity.ts | 5 +---- .../entities/subspace-model/subspace-model.entity.ts | 2 +- .../src/modules/space/dtos/space-product-allocation.dto.ts | 2 +- .../modules/space/dtos/subspace-product-allocation.dto.ts | 2 +- .../space/entities/space-product-allocation.entity.ts | 5 +---- .../entities/subspace/subspace-product-allocation.entity.ts | 5 +---- libs/common/src/modules/tag/entities/tag.entity.ts | 4 ++-- 10 files changed, 11 insertions(+), 29 deletions(-) diff --git a/libs/common/src/modules/space-model/dtos/space-model-product-allocation.dto.ts b/libs/common/src/modules/space-model/dtos/space-model-product-allocation.dto.ts index 64b4326..96ccd7c 100644 --- a/libs/common/src/modules/space-model/dtos/space-model-product-allocation.dto.ts +++ b/libs/common/src/modules/space-model/dtos/space-model-product-allocation.dto.ts @@ -23,13 +23,10 @@ export class SpaceModelProductAllocationDto { @Type(() => ProductDto) product: ProductDto; - @IsInt() - allowedQuantity: number; - @IsArray() @ValidateNested({ each: true }) @Type(() => NewTagDto) - allowedTags: NewTagDto[]; + tags: NewTagDto[]; @IsOptional() @IsArray() diff --git a/libs/common/src/modules/space-model/dtos/subspace-model/subspace-model-product-allocation.dto.ts b/libs/common/src/modules/space-model/dtos/subspace-model/subspace-model-product-allocation.dto.ts index 8fbc7ec..accb133 100644 --- a/libs/common/src/modules/space-model/dtos/subspace-model/subspace-model-product-allocation.dto.ts +++ b/libs/common/src/modules/space-model/dtos/subspace-model/subspace-model-product-allocation.dto.ts @@ -16,11 +16,8 @@ export class SubspaceModelProductAllocationDto { @Type(() => ProductDto) product: ProductDto; - @IsInt() - allowedQuantity: number; - @IsArray() @ValidateNested({ each: true }) @Type(() => NewTagDto) - allowedTags: NewTagDto[]; + tags: NewTagDto[]; } diff --git a/libs/common/src/modules/space-model/entities/space-model-product-allocation.entity.ts b/libs/common/src/modules/space-model/entities/space-model-product-allocation.entity.ts index 5675d75..7dcb0f5 100644 --- a/libs/common/src/modules/space-model/entities/space-model-product-allocation.entity.ts +++ b/libs/common/src/modules/space-model/entities/space-model-product-allocation.entity.ts @@ -31,12 +31,9 @@ export class SpaceModelProductAllocationEntity extends AbstractEntity ProductEntity, { nullable: false, onDelete: 'CASCADE' }) public product: ProductEntity; - @Column({ type: 'int', default: 1 }) - public allowedQuantity: number; - @ManyToMany(() => NewTagEntity) @JoinTable({ name: 'space_model_product_tags' }) - public allowedTags: NewTagEntity[]; + public tags: NewTagEntity[]; @OneToMany( () => SpaceProductAllocationEntity, diff --git a/libs/common/src/modules/space-model/entities/subspace-model/subspace-model-product-allocation.entity.ts b/libs/common/src/modules/space-model/entities/subspace-model/subspace-model-product-allocation.entity.ts index 2837bdb..902bb60 100644 --- a/libs/common/src/modules/space-model/entities/subspace-model/subspace-model-product-allocation.entity.ts +++ b/libs/common/src/modules/space-model/entities/subspace-model/subspace-model-product-allocation.entity.ts @@ -27,12 +27,9 @@ export class SubspaceModelProductAllocationEntity extends AbstractEntity ProductEntity, { nullable: false, onDelete: 'CASCADE' }) public product: ProductEntity; - @Column({ type: 'int', default: 1 }) - public allowedQuantity: number; - @ManyToMany(() => NewTagEntity, (tag) => tag.subspaceModelAllocations) @JoinTable({ name: 'subspace_model_product_tags' }) - public allowedTags: NewTagEntity[]; + public tags: NewTagEntity[]; constructor(partial: Partial) { super(); diff --git a/libs/common/src/modules/space-model/entities/subspace-model/subspace-model.entity.ts b/libs/common/src/modules/space-model/entities/subspace-model/subspace-model.entity.ts index 782bec6..932c855 100644 --- a/libs/common/src/modules/space-model/entities/subspace-model/subspace-model.entity.ts +++ b/libs/common/src/modules/space-model/entities/subspace-model/subspace-model.entity.ts @@ -33,7 +33,7 @@ export class SubspaceModelEntity extends AbstractEntity { @OneToMany(() => SubspaceEntity, (subspace) => subspace.subSpaceModel, { cascade: true, }) - public subspaceModel: SubspaceEntity[]; + public subspace: SubspaceEntity[]; @Column({ nullable: false, diff --git a/libs/common/src/modules/space/dtos/space-product-allocation.dto.ts b/libs/common/src/modules/space/dtos/space-product-allocation.dto.ts index 982e0e1..46dbf8a 100644 --- a/libs/common/src/modules/space/dtos/space-product-allocation.dto.ts +++ b/libs/common/src/modules/space/dtos/space-product-allocation.dto.ts @@ -20,5 +20,5 @@ export class SpaceProductAllocationDto { @IsArray() @ValidateNested({ each: true }) @Type(() => NewTagDto) - allowedTags: NewTagDto[]; + tags: NewTagDto[]; } diff --git a/libs/common/src/modules/space/dtos/subspace-product-allocation.dto.ts b/libs/common/src/modules/space/dtos/subspace-product-allocation.dto.ts index e1c296c..f297621 100644 --- a/libs/common/src/modules/space/dtos/subspace-product-allocation.dto.ts +++ b/libs/common/src/modules/space/dtos/subspace-product-allocation.dto.ts @@ -20,5 +20,5 @@ export class SubspaceProductAllocationDto { @IsArray() @ValidateNested({ each: true }) @Type(() => NewTagDto) - allowedTags: NewTagDto[]; + tags: NewTagDto[]; } diff --git a/libs/common/src/modules/space/entities/space-product-allocation.entity.ts b/libs/common/src/modules/space/entities/space-product-allocation.entity.ts index f41ea36..f8cb2fd 100644 --- a/libs/common/src/modules/space/entities/space-product-allocation.entity.ts +++ b/libs/common/src/modules/space/entities/space-product-allocation.entity.ts @@ -30,12 +30,9 @@ export class SpaceProductAllocationEntity extends AbstractEntity ProductEntity, { nullable: false, onDelete: 'CASCADE' }) public product: ProductEntity; - @Column({ type: 'int', default: 1 }) - public allowedQuantity: number; - @ManyToMany(() => NewTagEntity) @JoinTable({ name: 'space_product_tags' }) - public allowedTags: NewTagEntity[]; + public tags: NewTagEntity[]; constructor(partial: Partial) { super(); diff --git a/libs/common/src/modules/space/entities/subspace/subspace-product-allocation.entity.ts b/libs/common/src/modules/space/entities/subspace/subspace-product-allocation.entity.ts index 448993a..d0d3e9a 100644 --- a/libs/common/src/modules/space/entities/subspace/subspace-product-allocation.entity.ts +++ b/libs/common/src/modules/space/entities/subspace/subspace-product-allocation.entity.ts @@ -38,12 +38,9 @@ export class SubspaceProductAllocationEntity extends AbstractEntity ProductEntity, { nullable: false, onDelete: 'CASCADE' }) public product: ProductEntity; - @Column({ type: 'int', default: 1 }) - public allowedQuantity: number; - @ManyToMany(() => NewTagEntity) @JoinTable({ name: 'subspace_product_tags' }) - public allowedTags: NewTagEntity[]; + public tags: NewTagEntity[]; constructor(partial: Partial) { super(); diff --git a/libs/common/src/modules/tag/entities/tag.entity.ts b/libs/common/src/modules/tag/entities/tag.entity.ts index 921f57e..db20979 100644 --- a/libs/common/src/modules/tag/entities/tag.entity.ts +++ b/libs/common/src/modules/tag/entities/tag.entity.ts @@ -45,13 +45,13 @@ export class NewTagEntity extends AbstractEntity { @ManyToMany( () => SpaceModelProductAllocationEntity, - (allocation) => allocation.allowedTags, + (allocation) => allocation.tags, ) public spaceModelAllocations: SpaceModelProductAllocationEntity[]; @ManyToMany( () => SubspaceModelProductAllocationEntity, - (allocation) => allocation.allowedTags, + (allocation) => allocation.tags, ) public subspaceModelAllocations: SubspaceModelProductAllocationEntity[];