fixed entity relation, removed circular dependency

This commit is contained in:
hannathkadher
2025-02-10 20:36:29 +04:00
parent f5f9e9dfe3
commit e9a3cd14a8
40 changed files with 250 additions and 95 deletions

View File

@ -1,11 +1,13 @@
import { Entity, Column, ManyToOne, ManyToMany, JoinTable } from 'typeorm';
import { SpaceEntity } from './space.entity';
import { SpaceModelProductAllocationEntity } from '../../space-model';
import { ProductEntity } from '../../product/entities';
import { NewTagEntity } from '../../tag';
import { SpaceModelProductAllocationEntity } from '../../space-model/entities/space-model-product-allocation.entity';
import { ProductEntity } from '../../product/entities/product.entity';
import { NewTagEntity } from '../../tag/entities/tag.entity';
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
import { SpaceProductAllocationDto } from '../dtos/space-product-allocation.dto';
@Entity({ name: 'space_product_allocation' })
export class SpaceProductAllocationEntity {
export class SpaceProductAllocationEntity extends AbstractEntity<SpaceProductAllocationDto> {
@Column({
type: 'uuid',
default: () => 'gen_random_uuid()',
@ -34,4 +36,9 @@ export class SpaceProductAllocationEntity {
@ManyToMany(() => NewTagEntity)
@JoinTable({ name: 'space_product_tags' })
public allowedTags: NewTagEntity[];
constructor(partial: Partial<SpaceProductAllocationEntity>) {
super();
Object.assign(this, partial);
}
}