update notif content
This commit is contained in:
@@ -110,7 +110,7 @@ export class OrderListeners {
|
|||||||
restaurantId: event.restaurantId,
|
restaurantId: event.restaurantId,
|
||||||
message: {
|
message: {
|
||||||
title: NotifTitleEnum.ORDER_STATUS_CHANGED,
|
title: NotifTitleEnum.ORDER_STATUS_CHANGED,
|
||||||
content: `لطفا ثبت نظر سفارش ${event.orderNumber} به اپ مراجعه کنید`,
|
content: `لطفابرای ثبت نظر سفارش ${event.orderNumber} به اپ مراجعه کنید`,
|
||||||
sms: {
|
sms: {
|
||||||
templateId: this.orderCreatedSmsTemplateId ,
|
templateId: this.orderCreatedSmsTemplateId ,
|
||||||
parameters: {
|
parameters: {
|
||||||
@@ -119,7 +119,7 @@ export class OrderListeners {
|
|||||||
},
|
},
|
||||||
pushNotif: {
|
pushNotif: {
|
||||||
title: `تغییر وضعیت سفارش`,
|
title: `تغییر وضعیت سفارش`,
|
||||||
content: `لطفا ثبت نظر سفارش ${event.orderNumber} به اپ مراجعه کنید`,
|
content: `لطفا برای ثبت نظر سفارش ${event.orderNumber} به اپ مراجعه کنید`,
|
||||||
icon: `/`,
|
icon: `/`,
|
||||||
action: {
|
action: {
|
||||||
type: NotifTitleEnum.ORDER_STATUS_CHANGED,
|
type: NotifTitleEnum.ORDER_STATUS_CHANGED,
|
||||||
|
|||||||
@@ -34,16 +34,6 @@ export class RestaurantsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Admin Endpoints */
|
/** Admin Endpoints */
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
@ApiBearerAuth()
|
|
||||||
@Permissions(Permission.UPDATE_RESTAURANT)
|
|
||||||
@Post('admin/restaurants')
|
|
||||||
@ApiOperation({ summary: 'Create a new restaurant' })
|
|
||||||
@ApiBody({ type: CreateRestaurantDto })
|
|
||||||
create(@Body() createRestaurantDto: CreateRestaurantDto) {
|
|
||||||
return this.restaurantsService.create(createRestaurantDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@@ -81,4 +71,14 @@ export class RestaurantsController {
|
|||||||
findAll(@Query() dto: FindRestaurantsDto) {
|
findAll(@Query() dto: FindRestaurantsDto) {
|
||||||
return this.restaurantsService.findAll(dto);
|
return this.restaurantsService.findAll(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UseGuards(SuperAdminAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@ApiOperation({ summary: 'Create a new restaurant' })
|
||||||
|
@Post('super-admin/restaurants')
|
||||||
|
createRestaurant(@Body() createRestaurantDto: CreateRestaurantDto) {
|
||||||
|
return this.restaurantsService.create(createRestaurantDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
import { IsString, IsOptional, IsNumber, IsBoolean, IsArray, IsUrl, IsObject, IsEnum } from 'class-validator';
|
import { IsString, IsOptional, IsNumber } from 'class-validator';
|
||||||
import { PlanEnum } from '../interface/plan.interface';
|
|
||||||
|
|
||||||
export class CreateRestaurantDto {
|
export class CreateRestaurantDto {
|
||||||
@ApiProperty({ example: 'کافه ژیوان', description: 'نام رستوران' })
|
@ApiProperty({ example: 'کافه ژیوان', description: 'نام رستوران' })
|
||||||
@@ -11,56 +10,6 @@ export class CreateRestaurantDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
slug!: string;
|
slug!: string;
|
||||||
|
|
||||||
@ApiProperty({ example: 'zhivan.example.com', description: 'دامنه رستوران' })
|
|
||||||
@IsString()
|
|
||||||
domain!: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'https://example.com/logo.png', description: 'آدرس تصویر لوگو' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsUrl()
|
|
||||||
logo?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'تهران، خیابان ولیعصر پلاک ۱۲۳', description: 'آدرس کامل' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
address?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: '#ff6600', description: 'رنگ قالب/منو (hex)' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
menuColor?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 35.6892, description: 'عرض جغرافیایی (latitude)' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsNumber()
|
|
||||||
latitude?: number;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 51.389, description: 'طول جغرافیایی (longitude)' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsNumber()
|
|
||||||
longitude?: number;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({
|
|
||||||
example: {
|
|
||||||
type: 'Polygon',
|
|
||||||
coordinates: [
|
|
||||||
[
|
|
||||||
[51.389, 35.6892],
|
|
||||||
[51.39, 35.6892],
|
|
||||||
[51.39, 35.6902],
|
|
||||||
[51.389, 35.6902],
|
|
||||||
[51.389, 35.6892],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
description: 'محدوده سرویسدهی به صورت GeoJSON Polygon',
|
|
||||||
})
|
|
||||||
@IsOptional()
|
|
||||||
serviceArea?: {
|
|
||||||
type: 'Polygon';
|
|
||||||
coordinates: number[][][];
|
|
||||||
};
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 2020, description: 'سال تأسیس' })
|
@ApiPropertyOptional({ example: 2020, description: 'سال تأسیس' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@@ -71,88 +20,4 @@ export class CreateRestaurantDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
phone?: string;
|
phone?: string;
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'https://instagram.com/cafemorteza', description: 'آدرس اینستاگرام' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsUrl()
|
|
||||||
instagram?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'https://t.me/cafemorteza', description: 'آدرس تلگرام' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsUrl()
|
|
||||||
telegram?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'https://wa.me/989123456789', description: 'لینک واتساپ' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsUrl()
|
|
||||||
whatsapp?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'محل دنج با بهترین قهوه شهر.', description: 'توضیحات درباره رستوران' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
description?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'بهترین کافه تهران', description: 'عنوان برای SEO' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
seoTitle?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 'کافه مرتضی ارائهدهنده قهوه با کیفیت بالا.', description: 'توضیحات برای SEO' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
seoDescription?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: ['قهوه', 'صبحانه', 'کافه'], description: 'لیست تگهای مرتبط' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsArray()
|
|
||||||
tagNames?: string[];
|
|
||||||
|
|
||||||
@ApiPropertyOptional({
|
|
||||||
example: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg'],
|
|
||||||
description: 'لیست آدرس تصاویر رستوران',
|
|
||||||
type: [String],
|
|
||||||
})
|
|
||||||
@IsOptional()
|
|
||||||
@IsArray()
|
|
||||||
@IsUrl({}, { each: true })
|
|
||||||
images?: string[];
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: true, description: 'آیا رستوران اکنون باز است؟' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsBoolean()
|
|
||||||
isOpenNow?: boolean;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ example: 0.09, description: 'نرخ مالیات (مثلاً 0.09 برای 9%)' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsNumber()
|
|
||||||
vat?: number;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({
|
|
||||||
example: {
|
|
||||||
purchaseAmount: '100000',
|
|
||||||
purchaseScore: '100000',
|
|
||||||
scoreAmount: '100000',
|
|
||||||
scoreCredit: '100000',
|
|
||||||
birthdayScore: '100000',
|
|
||||||
registerScore: '100000',
|
|
||||||
marriageDateScore: '100000',
|
|
||||||
referrerScore: '100000',
|
|
||||||
},
|
|
||||||
description: 'مشخصات امتیازات',
|
|
||||||
})
|
|
||||||
@IsOptional()
|
|
||||||
@IsObject()
|
|
||||||
score?: {
|
|
||||||
purchaseAmount: string;
|
|
||||||
purchaseScore: string;
|
|
||||||
scoreAmount: string;
|
|
||||||
scoreCredit: string;
|
|
||||||
birthdayScore: string;
|
|
||||||
registerScore: string;
|
|
||||||
marriageDateScore: string;
|
|
||||||
referrerScore: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@ApiProperty({ example: true, description: 'PlanEnum.Base', enum: PlanEnum })
|
|
||||||
@IsEnum(PlanEnum)
|
|
||||||
plan: PlanEnum;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { RestRepository } from '../repositories/rest.repository';
|
|||||||
import { RestMessage } from 'src/common/enums/message.enum';
|
import { RestMessage } from 'src/common/enums/message.enum';
|
||||||
import { FindRestaurantsDto } from '../dto/find-restaurants.dto';
|
import { FindRestaurantsDto } from '../dto/find-restaurants.dto';
|
||||||
import { PaginatedResult } from 'src/common/interfaces/pagination.interface';
|
import { PaginatedResult } from 'src/common/interfaces/pagination.interface';
|
||||||
|
import { PlanEnum } from '../interface/plan.interface';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RestaurantsService {
|
export class RestaurantsService {
|
||||||
@@ -17,9 +18,13 @@ export class RestaurantsService {
|
|||||||
|
|
||||||
async create(dto: CreateRestaurantDto): Promise<Restaurant> {
|
async create(dto: CreateRestaurantDto): Promise<Restaurant> {
|
||||||
const restaurant = this.em.create(Restaurant, {
|
const restaurant = this.em.create(Restaurant, {
|
||||||
...dto,
|
name: dto.name,
|
||||||
|
slug: dto.slug,
|
||||||
|
establishedYear: dto.establishedYear,
|
||||||
|
phone: dto.phone,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
plan: dto.plan,
|
plan: PlanEnum.Base,
|
||||||
|
domain: `https://dmenu-plus-front.dev.danakcorp.com/${dto.slug}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.em.persistAndFlush(restaurant);
|
await this.em.persistAndFlush(restaurant);
|
||||||
|
|||||||
Reference in New Issue
Block a user