added the relation between models and space

This commit is contained in:
hannathkadher
2024-12-11 16:06:51 +04:00
parent 88a4b26919
commit 6d8c9a0ec0
8 changed files with 64 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import { SpaceModelDto } from '../dtos';
import { SubspaceModelEntity } from './subspace-model.entity';
import { SpaceProductModelEntity } from './space-product-model.entity';
import { ProjectEntity } from '../../project/entities';
import { SpaceEntity } from '../../space/entities';
@Entity({ name: 'space-model' })
@Unique(['modelName', 'project'])
@ -53,4 +54,9 @@ export class SpaceModelEntity extends AbstractEntity<SpaceModelDto> {
},
)
public spaceProductModels: SpaceProductModelEntity[];
@OneToMany(() => SpaceEntity, (space) => space.spaceModel, {
cascade: true,
})
public spaces: SpaceEntity[];
}