verify cash paymnt

This commit is contained in:
2025-12-19 20:58:19 +03:30
parent 2ce7dda168
commit 465810efc2
8 changed files with 70 additions and 40 deletions
@@ -1,5 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsString, IsOptional, IsNumber, IsBoolean, IsArray, IsUrl, IsObject } from 'class-validator';
import { IsString, IsOptional, IsNumber, IsBoolean, IsArray, IsUrl, IsObject, IsEnum } from 'class-validator';
import { PlanEnum } from '../interface/plan.interface';
export class CreateRestaurantDto {
@ApiProperty({ example: 'کافه ژیوان', description: 'نام رستوران' })
@@ -65,7 +66,6 @@ export class CreateRestaurantDto {
@IsNumber()
establishedYear?: number;
@ApiPropertyOptional({ example: '09123456789', description: 'شماره تلفن' })
@IsOptional()
@IsString()
@@ -151,4 +151,8 @@ export class CreateRestaurantDto {
marriageDateScore: string;
referrerScore: string;
};
@ApiProperty({ example: true, description: 'PlanEnum.Base', enum: PlanEnum })
@IsEnum(PlanEnum)
plan: PlanEnum;
}
@@ -1,6 +1,7 @@
import { Collection, Entity, Index, OneToMany, Property } from '@mikro-orm/core';
import { Collection, Entity, Enum, Index, OneToMany, Property } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Delivery } from '../../delivery/entities/delivery.entity';
import { PlanEnum } from '../interface/plan.interface';
@Entity({ tableName: 'restaurants' })
@Index({ properties: ['isActive'] })
@@ -42,7 +43,6 @@ export class Restaurant extends BaseEntity {
@Property({ nullable: true })
establishedYear?: number;
@Property({ nullable: true })
phone?: string;
@@ -96,4 +96,7 @@ export class Restaurant extends BaseEntity {
marriageDateScore: string;
referrerScore: string;
} | null = null;
@Enum(() => PlanEnum)
plan: PlanEnum = PlanEnum.Base;
}
@@ -0,0 +1,4 @@
export enum PlanEnum {
Base = 'base',
Premium = 'premium',
}
@@ -1,7 +1,7 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { CreateRestaurantDto } from '../dto/create-restaurant.dto';
import { UpdateRestaurantDto } from '../dto/update-restaurant.dto';
import { Restaurant } from '../entities/restaurant.entity';
import { Restaurant } from '../entities/restaurant.entity';
import { EntityManager } from '@mikro-orm/postgresql';
import { RestRepository } from '../repositories/rest.repository';
import { RestMessage } from 'src/common/enums/message.enum';
@@ -17,6 +17,7 @@ export class RestaurantsService {
const restaurant = this.em.create(Restaurant, {
...dto,
isActive: true,
plan: dto.plan,
});
await this.em.persistAndFlush(restaurant);