This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { CreateRestaurantDto } from '../dto/create-restaurant.dto';
|
||||
import { SetupRestaurantDto } from '../dto/setup-restaurant.dto';
|
||||
import { UpdateRestaurantDto } from '../dto/update-restaurant.dto';
|
||||
import { UpdateRestaurantBgDto } from '../dto/update-restaurant-bg.dto';
|
||||
import { UpgradeSubscriptionDto } from '../dto/upgrade-subscription.dto';
|
||||
@@ -43,7 +43,7 @@ export class RestaurantsService {
|
||||
private readonly cacheService: CacheService,
|
||||
) { }
|
||||
|
||||
async setupRestuarant(dto: CreateRestaurantDto): Promise<Restaurant> {
|
||||
async setupRestuarant(dto: SetupRestaurantDto): Promise<Restaurant> {
|
||||
return await this.em.transactional(async (em) => {
|
||||
// Generate or validate slug
|
||||
const slug = slugify(dto.slug ?? dto.name, {
|
||||
@@ -63,7 +63,7 @@ export class RestaurantsService {
|
||||
name: dto.name,
|
||||
slug,
|
||||
establishedYear: dto.establishedYear,
|
||||
phone: dto.phone,
|
||||
phones: dto.phone ? [dto.phone] : undefined,
|
||||
isActive: true,
|
||||
plan: dto.plan,
|
||||
domain: `https://dmenu.danakcorp.com/${slug}`,
|
||||
@@ -79,7 +79,7 @@ export class RestaurantsService {
|
||||
throw new BadRequestException(`Role not found for plan: ${dto.plan}`);
|
||||
}
|
||||
|
||||
const normalizedPhone = normalizePhone(dto.phone);
|
||||
const normalizedPhone = normalizePhone(dto.phone ?? '');
|
||||
let admin = await em.findOne(Admin, { phone: normalizedPhone });
|
||||
if (!admin) {
|
||||
admin = em.create(Admin, {
|
||||
|
||||
Reference in New Issue
Block a user