variant
This commit is contained in:
@@ -22,7 +22,7 @@ export class BulkAddItemsToCartDto {
|
||||
type: [AddItemToCartDto],
|
||||
example: [
|
||||
{ variantId: 'product-123', quantity: 2 },
|
||||
{ productId: 'product-456', quantity: 1 },
|
||||
{ variantId: 'product-456', quantity: 1 },
|
||||
],
|
||||
})
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Cascade, Collection, Entity, Index, ManyToOne, OneToMany, Property, OneToOne } from '@mikro-orm/core';
|
||||
import { Cascade, Collection, Entity, Index, ManyToOne, OneToMany, Property } from '@mikro-orm/core';
|
||||
import { Category } from './category.entity';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Shop } from '../../../modules/shops/entities/shop.entity';
|
||||
@@ -8,6 +8,7 @@ import { Variant } from './variant.entity';
|
||||
|
||||
@Entity({ tableName: 'products' })
|
||||
@Index({ properties: ['shop', 'isActive'] })
|
||||
@Index({ properties: ['shop'] })
|
||||
@Index({ properties: ['category', 'isActive'] })
|
||||
@Index({ properties: ['isActive'] })
|
||||
export class Product extends BaseEntity {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Entity, Property } from '@mikro-orm/core';
|
||||
import { Entity, Index, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
|
||||
@Entity({ tableName: 'schedules' })
|
||||
@Index({ properties: ['shopId'] })
|
||||
export class Schedule extends BaseEntity {
|
||||
@Property({ type: 'int' })
|
||||
weekDay!: number;
|
||||
|
||||
@@ -4,8 +4,7 @@ import { Delivery } from '../../delivery/entities/delivery.entity';
|
||||
import { Product } from 'src/modules/products/entities/product.entity';
|
||||
|
||||
@Entity({ tableName: 'shops' })
|
||||
@Index({ properties: ['isActive'] })
|
||||
@Index({ properties: ['slug', 'isActive'] })
|
||||
@Index({ properties: ['slug'] })
|
||||
export class Shop extends BaseEntity {
|
||||
|
||||
@OneToMany(() => Product, (product) => product.shop)
|
||||
|
||||
@@ -21,7 +21,7 @@ export const deliveryMethodsData: DeliveryMethodData[] = [
|
||||
{
|
||||
method: DeliveryMethodEnum.DeliveryCourier,
|
||||
description: 'تحویل غذا با پیک',
|
||||
deliveryFee: 10000,
|
||||
deliveryFee: 100000,
|
||||
minOrderPrice: 100000,
|
||||
enabled: true,
|
||||
order: 4,
|
||||
|
||||
@@ -15,6 +15,7 @@ export class DeliveryMethodsSeeder {
|
||||
method: methodData.method,
|
||||
});
|
||||
|
||||
|
||||
if (!existing) {
|
||||
const delivery = em.create(Delivery, {
|
||||
shop,
|
||||
|
||||
Reference in New Issue
Block a user