phone ==.>phones
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-29 12:09:33 +03:30
parent 7e7f49a96b
commit f6d1716ad0
7 changed files with 224 additions and 99 deletions
@@ -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, {