shipment methods
This commit is contained in:
@@ -39,11 +39,12 @@ export class AdminService {
|
|||||||
|
|
||||||
async createAdminForMyRestaurant(restId: string, dto: CreateMyRestaurantAdminDto) {
|
async createAdminForMyRestaurant(restId: string, dto: CreateMyRestaurantAdminDto) {
|
||||||
const { phone, firstName, lastName, roleId } = dto;
|
const { phone, firstName, lastName, roleId } = dto;
|
||||||
const currentAdmin = await this.adminRepository.findOne({
|
let currentAdmin: Admin | null = null;
|
||||||
|
currentAdmin = await this.adminRepository.findOne({
|
||||||
phone,
|
phone,
|
||||||
});
|
});
|
||||||
if (!currentAdmin) {
|
if (!currentAdmin) {
|
||||||
await this.adminRepository.findOne({
|
currentAdmin = await this.adminRepository.findOne({
|
||||||
phone,
|
phone,
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core';
|
import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core';
|
||||||
import { Restaurant } from './restaurant.entity';
|
import { Restaurant } from './restaurant.entity';
|
||||||
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
||||||
|
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'restaurant_shipment_methods' })
|
@Entity({ tableName: 'restaurant_shipment_methods' })
|
||||||
@Unique({ properties: ['restaurant', 'shipmentMethod'] })
|
@Unique({ properties: ['restaurant', 'shipmentMethod'] })
|
||||||
export class RestaurantShipmentMethod {
|
export class RestaurantShipmentMethod extends BaseEntity {
|
||||||
@ManyToOne(() => Restaurant, { primary: true })
|
@ManyToOne(() => Restaurant, { primary: true })
|
||||||
restaurant!: Restaurant;
|
restaurant!: Restaurant;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user