update is acive

This commit is contained in:
2026-02-02 12:25:40 +03:30
parent 96108d0b35
commit f72012e2a6
2 changed files with 10 additions and 2 deletions
@@ -1,5 +1,5 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; 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 { Type } from 'class-transformer';
import { PlanEnum } from '../interface/plan.interface'; import { PlanEnum } from '../interface/plan.interface';
@@ -46,4 +46,9 @@ export class CreateRestaurantDto {
@IsDate() @IsDate()
subscriptionStartDate!: Date; subscriptionStartDate!: Date;
@ApiProperty()
@IsBoolean()
isActive?: boolean;
} }
@@ -214,9 +214,12 @@ export class RestaurantsService {
throw new NotFoundException(RestMessage.NOT_FOUND); throw new NotFoundException(RestMessage.NOT_FOUND);
} }
const isActive = new Date(dto.subscriptionEndDate) > new Date()
await this.update(restaurant.id, { await this.update(restaurant.id, {
plan: dto.newPlan, plan: dto.newPlan,
subscriptionEndDate:dto.subscriptionEndDate subscriptionEndDate: dto.subscriptionEndDate,
isActive
}) })
return restaurant; return restaurant;