entity bugs
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Entity, Enum, Property } from '@mikro-orm/core';
|
||||
import { Entity, Enum, ManyToOne, 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 {
|
||||
@Property({ type: 'bigint' })
|
||||
productId: string
|
||||
@ManyToOne(()=>Product)
|
||||
product: Product
|
||||
|
||||
@Property({ primary: true })
|
||||
id: bigint;
|
||||
|
||||
@@ -12,7 +12,7 @@ export class Product extends BaseEntity {
|
||||
@ManyToOne(() => Category)
|
||||
category: Category
|
||||
|
||||
@OneToMany(() => Attribute, (attr) => attr.productId)
|
||||
@OneToMany(() => Attribute, (attr) => attr.product)
|
||||
attributes = new Collection<Attribute>(this)
|
||||
|
||||
@Property()
|
||||
|
||||
@@ -10,6 +10,7 @@ import { AttributeValue } from './entities/attribute-value.entity';
|
||||
import { AuthModule } from '../auth/auth.module';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { UtilsModule } from '../util/utils.module';
|
||||
import { CategoryRepository } from './repositories/category.repository';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -19,7 +20,7 @@ import { UtilsModule } from '../util/utils.module';
|
||||
UtilsModule,
|
||||
],
|
||||
controllers: [productController,],
|
||||
providers: [productService, ProductRepository,],
|
||||
exports: [ProductRepository,],
|
||||
providers: [productService, ProductRepository,CategoryRepository],
|
||||
exports: [ProductRepository,CategoryRepository],
|
||||
})
|
||||
export class productModule { }
|
||||
|
||||
Reference in New Issue
Block a user