From 08e2da0e5c6b4d0fac30dc5dd2d0a192b7cd397d Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sun, 23 Nov 2025 16:16:10 +0330 Subject: [PATCH] shipment methods --- src/modules/admin/providers/admin.service.ts | 7 ++++--- .../entities/restaurant-shipment-method.entity.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/admin/providers/admin.service.ts b/src/modules/admin/providers/admin.service.ts index 24c13df..1368311 100644 --- a/src/modules/admin/providers/admin.service.ts +++ b/src/modules/admin/providers/admin.service.ts @@ -39,11 +39,12 @@ export class AdminService { async createAdminForMyRestaurant(restId: string, dto: CreateMyRestaurantAdminDto) { const { phone, firstName, lastName, roleId } = dto; - const currentAdmin = await this.adminRepository.findOne({ + let currentAdmin: Admin | null = null; + currentAdmin = await this.adminRepository.findOne({ phone, - }); + }); if (!currentAdmin) { - await this.adminRepository.findOne({ + currentAdmin = await this.adminRepository.findOne({ phone, firstName, lastName, diff --git a/src/modules/restaurants/entities/restaurant-shipment-method.entity.ts b/src/modules/restaurants/entities/restaurant-shipment-method.entity.ts index 3a643ab..d89d33b 100644 --- a/src/modules/restaurants/entities/restaurant-shipment-method.entity.ts +++ b/src/modules/restaurants/entities/restaurant-shipment-method.entity.ts @@ -1,10 +1,11 @@ import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core'; import { Restaurant } from './restaurant.entity'; import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity'; +import { BaseEntity } from 'src/common/entities/base.entity'; @Entity({ tableName: 'restaurant_shipment_methods' }) @Unique({ properties: ['restaurant', 'shipmentMethod'] }) -export class RestaurantShipmentMethod { +export class RestaurantShipmentMethod extends BaseEntity { @ManyToOne(() => Restaurant, { primary: true }) restaurant!: Restaurant;