added subspace and space product allocation entity

This commit is contained in:
hannathkadher
2025-02-10 12:58:49 +04:00
parent 8d4e10ff1c
commit 4c7208cd5f
5 changed files with 101 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
import { SubspaceDto } from '../../dtos';
import { SpaceEntity } from '../space.entity';
import { TagEntity } from '../tag.entity';
import { SubspaceProductAllocationEntity } from './subspace-product-allocation.entity';
@Entity({ name: 'subspace' })
export class SubspaceEntity extends AbstractEntity<SubspaceDto> {
@ -45,6 +46,13 @@ export class SubspaceEntity extends AbstractEntity<SubspaceDto> {
@OneToMany(() => TagEntity, (tag) => tag.subspace)
tags: TagEntity[];
@OneToMany(
() => SubspaceProductAllocationEntity,
(allocation) => allocation.subspace,
{ cascade: true },
)
public productAllocations: SubspaceProductAllocationEntity[];
constructor(partial: Partial<SubspaceEntity>) {
super();
Object.assign(this, partial);