attribute values
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { AttributeType } from '../interface/product.interface';
|
||||
import { Product } from './product.entity';
|
||||
import { AttributeValue } from './attribute-value.entity';
|
||||
|
||||
@Entity({ tableName: 'attributes' })
|
||||
export class Attribute extends BaseEntity {
|
||||
@@ -12,7 +13,10 @@ export class Attribute extends BaseEntity {
|
||||
parent?: Attribute | null
|
||||
|
||||
@OneToMany(() => Attribute, (c) => c.parent)
|
||||
children?: Attribute[]
|
||||
children=new Collection<Attribute>(this)
|
||||
|
||||
@OneToMany(() => AttributeValue, (attrValue) => attrValue.attribute)
|
||||
values= new Collection<AttributeValue>(this)
|
||||
|
||||
@PrimaryKey({ type: 'bigint', autoincrement: true })
|
||||
id: bigint;
|
||||
|
||||
Reference in New Issue
Block a user