This commit is contained in:
2026-02-12 11:29:31 +03:30
parent 27ed70a3a5
commit 8b45f5f0ee
6 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ export class BulkAddItemsToCartDto {
type: [AddItemToCartDto], type: [AddItemToCartDto],
example: [ example: [
{ variantId: 'product-123', quantity: 2 }, { variantId: 'product-123', quantity: 2 },
{ productId: 'product-456', quantity: 1 }, { variantId: 'product-456', quantity: 1 },
], ],
}) })
@IsNotEmpty() @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 { Category } from './category.entity';
import { BaseEntity } from '../../../common/entities/base.entity'; import { BaseEntity } from '../../../common/entities/base.entity';
import { Shop } from '../../../modules/shops/entities/shop.entity'; import { Shop } from '../../../modules/shops/entities/shop.entity';
@@ -8,6 +8,7 @@ import { Variant } from './variant.entity';
@Entity({ tableName: 'products' }) @Entity({ tableName: 'products' })
@Index({ properties: ['shop', 'isActive'] }) @Index({ properties: ['shop', 'isActive'] })
@Index({ properties: ['shop'] })
@Index({ properties: ['category', 'isActive'] }) @Index({ properties: ['category', 'isActive'] })
@Index({ properties: ['isActive'] }) @Index({ properties: ['isActive'] })
export class Product extends BaseEntity { 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'; import { BaseEntity } from '../../../common/entities/base.entity';
@Entity({ tableName: 'schedules' }) @Entity({ tableName: 'schedules' })
@Index({ properties: ['shopId'] })
export class Schedule extends BaseEntity { export class Schedule extends BaseEntity {
@Property({ type: 'int' }) @Property({ type: 'int' })
weekDay!: number; weekDay!: number;
+1 -2
View File
@@ -4,8 +4,7 @@ import { Delivery } from '../../delivery/entities/delivery.entity';
import { Product } from 'src/modules/products/entities/product.entity'; import { Product } from 'src/modules/products/entities/product.entity';
@Entity({ tableName: 'shops' }) @Entity({ tableName: 'shops' })
@Index({ properties: ['isActive'] }) @Index({ properties: ['slug'] })
@Index({ properties: ['slug', 'isActive'] })
export class Shop extends BaseEntity { export class Shop extends BaseEntity {
@OneToMany(() => Product, (product) => product.shop) @OneToMany(() => Product, (product) => product.shop)
+1 -1
View File
@@ -21,7 +21,7 @@ export const deliveryMethodsData: DeliveryMethodData[] = [
{ {
method: DeliveryMethodEnum.DeliveryCourier, method: DeliveryMethodEnum.DeliveryCourier,
description: 'تحویل غذا با پیک', description: 'تحویل غذا با پیک',
deliveryFee: 10000, deliveryFee: 100000,
minOrderPrice: 100000, minOrderPrice: 100000,
enabled: true, enabled: true,
order: 4, order: 4,
+1
View File
@@ -15,6 +15,7 @@ export class DeliveryMethodsSeeder {
method: methodData.method, method: methodData.method,
}); });
if (!existing) { if (!existing) {
const delivery = em.create(Delivery, { const delivery = em.create(Delivery, {
shop, shop,