production
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { Entity, Property, ManyToOne } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Attribute } from './attribute.entity';
|
||||
|
||||
@Entity({ tableName: 'attribute_values' })
|
||||
export class AttributeValue extends BaseEntity {
|
||||
@Property({ primary: true })
|
||||
id: bigint;
|
||||
|
||||
@Property()
|
||||
value: string;
|
||||
|
||||
@ManyToOne(() => Attribute)
|
||||
attribute: Attribute;
|
||||
|
||||
@Property({ type: 'bigint' })
|
||||
attributeId: bigint;
|
||||
|
||||
@Property({ type: 'int', nullable: true })
|
||||
sortOrder?: number;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Entity, Enum, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { AttributeType } from '../interface/product.interface';
|
||||
|
||||
@Entity({ tableName: 'attributes' })
|
||||
export class Attribute extends BaseEntity {
|
||||
@Property({ primary: true })
|
||||
id: bigint;
|
||||
|
||||
@Property()
|
||||
name: string;
|
||||
|
||||
@Enum()
|
||||
type: AttributeType;
|
||||
|
||||
@Property({ type: 'boolean', default: false })
|
||||
isRequired: boolean = false;
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { Entity, Index, Property, Collection, OneToMany, ManyToOne } from '@mikro-orm/core';
|
||||
import { product } from './product.entity';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity';
|
||||
|
||||
@Entity({ tableName: 'categories' })
|
||||
@Index({ properties: ['restaurant', 'isActive'] })
|
||||
@Index({ properties: ['isActive'] })
|
||||
export class Category extends BaseEntity {
|
||||
@Property()
|
||||
title!: string;
|
||||
|
||||
@OneToMany(() => product, product => product.category)
|
||||
products = new Collection<product>(this);
|
||||
|
||||
@Property({ default: true })
|
||||
isActive: boolean = true;
|
||||
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
@Property({ nullable: true })
|
||||
avatarUrl?: string;
|
||||
|
||||
@Property({ type: 'int', nullable: true })
|
||||
order?: number;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { Entity, ManyToOne, Unique } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { User } from '../../user/entities/user.entity';
|
||||
import { product } from '../../products/entities/product.entity';
|
||||
|
||||
@Entity({ tableName: 'favorites' })
|
||||
@Unique({ properties: ['user', 'product'] })
|
||||
export class Favorite extends BaseEntity {
|
||||
@ManyToOne(() => User)
|
||||
user: User;
|
||||
|
||||
@ManyToOne(() => product)
|
||||
product: product;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { Entity, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
|
||||
|
||||
@Entity({ tableName: 'products' })
|
||||
export class product extends BaseEntity {
|
||||
|
||||
|
||||
@Property({ nullable: true })
|
||||
title?: string;
|
||||
|
||||
@Property({ type: 'text', nullable: true })
|
||||
linkUrl?: string;
|
||||
|
||||
|
||||
@Property({ type: 'boolean', default: true })
|
||||
isActive: boolean = true;
|
||||
|
||||
@Property({ type: 'json', nullable: true })
|
||||
images?: string[];
|
||||
|
||||
|
||||
}
|
||||
@@ -4,20 +4,19 @@ import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
|
||||
@Entity({ tableName: 'products' })
|
||||
export class product extends BaseEntity {
|
||||
@Property({ primary: true })
|
||||
id: bigint
|
||||
|
||||
|
||||
@Property({ nullable: true })
|
||||
title?: string;
|
||||
@Property()
|
||||
title: string;
|
||||
|
||||
@Property({ type: 'text', nullable: true })
|
||||
linkUrl?: string;
|
||||
|
||||
|
||||
@Property({ type: 'boolean', default: true })
|
||||
isActive: boolean = true;
|
||||
|
||||
@Property({ type: 'json', nullable: true })
|
||||
images?: string[];
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user