From f72012e2a6c151fbea16ed24c64859395073bd34 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Mon, 2 Feb 2026 12:25:40 +0330 Subject: [PATCH] update is acive --- src/modules/restaurants/dto/create-restaurant.dto.ts | 7 ++++++- src/modules/restaurants/providers/restaurants.service.ts | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/restaurants/dto/create-restaurant.dto.ts b/src/modules/restaurants/dto/create-restaurant.dto.ts index 1241574..fbfb106 100644 --- a/src/modules/restaurants/dto/create-restaurant.dto.ts +++ b/src/modules/restaurants/dto/create-restaurant.dto.ts @@ -1,5 +1,5 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { IsString, IsOptional, IsNumber, IsDate, IsEnum } from 'class-validator'; +import { IsString, IsOptional, IsNumber, IsDate, IsEnum, IsBoolean } from 'class-validator'; import { Type } from 'class-transformer'; import { PlanEnum } from '../interface/plan.interface'; @@ -46,4 +46,9 @@ export class CreateRestaurantDto { @IsDate() subscriptionStartDate!: Date; + + @ApiProperty() + @IsBoolean() + isActive?: boolean; + } diff --git a/src/modules/restaurants/providers/restaurants.service.ts b/src/modules/restaurants/providers/restaurants.service.ts index eb21602..c75bfc6 100644 --- a/src/modules/restaurants/providers/restaurants.service.ts +++ b/src/modules/restaurants/providers/restaurants.service.ts @@ -214,9 +214,12 @@ export class RestaurantsService { throw new NotFoundException(RestMessage.NOT_FOUND); } + const isActive = new Date(dto.subscriptionEndDate) > new Date() + await this.update(restaurant.id, { plan: dto.newPlan, - subscriptionEndDate:dto.subscriptionEndDate + subscriptionEndDate: dto.subscriptionEndDate, + isActive }) return restaurant;