Files
backend/libs/common/src/modules/space/entities/space-product-item.entity.ts
2024-12-12 14:37:44 +04:00

28 lines
849 B
TypeScript

import { Column, Entity, ManyToOne } from 'typeorm';
import { SpaceProductEntity } from './space-product.entity';
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
import { SpaceProductItemDto } from '../dtos';
import { SpaceProductItemModelEntity } from '../../space-model';
@Entity({ name: 'space-product-item' })
export class SpaceProductItemEntity extends AbstractEntity<SpaceProductItemDto> {
@Column({
nullable: false,
})
public tag: string;
@ManyToOne(() => SpaceProductEntity, (spaceProduct) => spaceProduct.items, {
nullable: false,
})
public spaceProduct: SpaceProductEntity;
@ManyToOne(
() => SpaceProductItemModelEntity,
(spaceProductItemModel) => spaceProductItemModel.items,
{
nullable: true,
},
)
public spaceProductItemModel?: SpaceProductItemModelEntity;
}