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