Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/modules/notification_events/dto/searchTemplateType.dto.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsNotEmpty, IsOptional, IsString, ValidateNested, } from "class-validator";
import { IsOptional, IsString, ValidateNested, } from "class-validator";

export class SearchDto {

@ApiProperty({ example: 'EVENT' })
@ApiProperty({ example: 'EVENT', required: false })
@IsOptional()
@IsString()
@IsNotEmpty()
context: string;
context?: string;
Comment thread
VaishnaviSidral marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

@ApiProperty({ example: 'EVENT' })
@IsOptional()
@IsString()
@IsNotEmpty()
key: string;
}

export class SearchFilterDto {
@ApiProperty({ type: SearchDto, description: 'Filters for search' })
@ValidateNested({ each: true })
@ApiProperty({ type: SearchDto, description: 'Filters for search', required: false })
@IsOptional()
@ValidateNested()
@Type(() => SearchDto)
@IsNotEmpty()
filters: SearchDto
filters?: SearchDto
}
11 changes: 8 additions & 3 deletions src/modules/notification_events/notification_events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,15 @@ export class NotificationEventsService {
response: Response
) {
const apiId = APIID.TEMPLATE_LIST;
const { context } = searchFilterDto.filters;
const key = searchFilterDto.filters?.key;
const context = searchFilterDto?.filters?.context;
const key = searchFilterDto?.filters?.key;

let whereCondition: any = { context };
let whereCondition: any = {};

if (context) {
whereCondition.context = context;
}

if (key) {
whereCondition.key = key;
}
Expand Down