added subspace product item

This commit is contained in:
hannathkadher
2024-12-13 15:57:25 +04:00
parent 654642db6c
commit 7cab62b02a
5 changed files with 31 additions and 22 deletions
@@ -13,14 +13,14 @@ export class SubspaceProductItemModelEntity extends AbstractEntity<SubspaceProdu
@ManyToOne(
() => SubspaceProductModelEntity,
(subspaceProductModel) => subspaceProductModel.items,
(productModel) => productModel.itemModels,
{
nullable: false,
},
)
public subspaceProductModel: SubspaceProductModelEntity;
@OneToMany(() => SubspaceProductItemEntity, (item) => item.model, {
@OneToMany(() => SubspaceProductItemEntity, (item) => item.subspaceProduct, {
nullable: true,
})
items: SubspaceProductItemEntity[];
@@ -3,6 +3,7 @@ import { SubpaceProductModelDto } from '../../dtos';
import { AbstractEntity } from '@app/common/modules/abstract/entities/abstract.entity';
import { SubspaceModelEntity } from './subspace-model.entity';
import { ProductEntity } from '@app/common/modules/product/entities';
import { SubspaceProductEntity } from '@app/common/modules/space/entities';
import { SubspaceProductItemModelEntity } from './subspace-product-item-model.entity';
@Entity({ name: 'subspace-product-model' })
@@ -27,12 +28,17 @@ export class SubspaceProductModelEntity extends AbstractEntity<SubpaceProductMod
})
public product: ProductEntity;
@OneToMany(() => SubspaceProductEntity, (product) => product.model, {
nullable: true,
})
public subspaceProducts: SubspaceProductEntity[];
@OneToMany(
() => SubspaceProductItemModelEntity,
(item) => item.subspaceProductModel,
(product) => product.subspaceProductModel,
{
cascade: true,
nullable: true,
},
)
public items: SubspaceProductItemModelEntity[];
public itemModels: SubspaceProductItemModelEntity[];
}