fix : create restuarant
This commit is contained in:
@@ -1,24 +1,12 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional, IsNumber } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class SetupRestaurantDto {
|
||||
@ApiProperty({ example: 'کافه ژیوان', description: 'نام رستوران' })
|
||||
@IsString()
|
||||
name!: string;
|
||||
|
||||
@ApiProperty({ example: 'zhivan', description: 'شناسه (slug) رستوران، لاتین و بدون فاصله' })
|
||||
@IsString()
|
||||
slug!: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 2020, description: 'سال تأسیس' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
establishedYear: number;
|
||||
|
||||
@ApiPropertyOptional({ example: '09123456789', description: 'شماره تلفن' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
phone: string;
|
||||
|
||||
@ApiProperty({ example: 'sub_1234567890', description: 'شناسه اشتراک' })
|
||||
@IsString()
|
||||
|
||||
@@ -124,11 +124,17 @@ export class RestaurantService {
|
||||
}
|
||||
const plan = userSubscription.plan.name.includes("دلیوری") ? PlanEnum.Premium : PlanEnum.Base;
|
||||
|
||||
const user = await this.usersService.findOneById(userSubscription.user.id)
|
||||
|
||||
if (!user) {
|
||||
throw new BadRequestException("User Not found");
|
||||
}
|
||||
|
||||
const setupRestaurantDto: ISetupRestaurant = {
|
||||
name: dto.name,
|
||||
name: userSubscription.businessName,
|
||||
slug: dto.slug,
|
||||
establishedYear: dto.establishedYear,
|
||||
phone: dto.phone,
|
||||
establishedYear: 1400,
|
||||
phone: user.user.phone,
|
||||
plan,
|
||||
subscriptionId: dto.userSubscriptionId,
|
||||
subscriptionEndDate: userSubscription.endDate.toISOString(),
|
||||
|
||||
Reference in New Issue
Block a user