crud product

This commit is contained in:
2026-01-13 18:19:51 +03:30
parent 984b889587
commit 6522acff5f
27 changed files with 333 additions and 1080 deletions
+19 -2
View File
@@ -1,15 +1,29 @@
import { Entity, Property } from '@mikro-orm/core';
import { Collection, Entity, ManyToOne, OneToMany, Property } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Category } from './category.entity';
import { Attribute } from './attribute.entity';
@Entity({ tableName: 'products' })
export class product extends BaseEntity {
export class Product extends BaseEntity {
@Property({ primary: true })
id: bigint
@ManyToOne(() => Category)
category: Category
@OneToMany(() => Attribute, (attr) => attr.productId)
attributes = new Collection<Attribute>(this)
@Property()
title: string;
@Property({ type: 'json' })
desc: string[]
@Property()
prepareTime: number;
@Property({ type: 'text', nullable: true })
linkUrl?: string;
@@ -19,4 +33,7 @@ export class product extends BaseEntity {
@Property({ type: 'json', nullable: true })
images?: string[];
@Property({ type: 'int' })
order?: number | null
}