update is acive
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user