attribute

This commit is contained in:
2026-01-16 19:11:57 +03:30
parent 17b4b30a3f
commit d9bc1fa0b2
10 changed files with 30 additions and 25 deletions
@@ -1,26 +1,26 @@
import { Entity, Enum, ManyToOne, OneToMany, Property } from '@mikro-orm/core';
import { 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';
@Entity({ tableName: 'attributes' })
export class Attribute extends BaseEntity {
@ManyToOne(()=>Product)
@ManyToOne(() => Product)
product: Product
@ManyToOne(() => Attribute, { nullable: true })
parent?: Attribute | null
@OneToMany(() => Attribute, (c) => c.parent)
children?: Attribute[]
@Property({ primary: true })
id: bigint;
@PrimaryKey({ type: 'bigint', autoincrement: true })
id: number;
@Property()
name: string;
@Enum()
@Enum(() => AttributeType)
type: AttributeType;
@Property({ type: 'boolean', default: false })