adjusted filter in find form

This commit is contained in:
Suman991 2026-04-09 17:20:40 +05:30
parent 2079f3873c
commit 5cddfb43de
2 changed files with 2 additions and 3 deletions

View File

@ -84,7 +84,7 @@ export class FormService {
async find(formId: string): Promise<Form> { async find(formId: string): Promise<Form> {
const form = await this.formModel const form = await this.formModel
.findOne({ id: formId, deletedAt: null }) .findOne({ id: formId, deletedAt: null })
.select(LIST_PROJECTION) .select(DETAIL_PROJECTION)
.exec(); .exec();
if (!form) throw new NotFoundException(`Form ${formId} not found`); if (!form) throw new NotFoundException(`Form ${formId} not found`);
return form; return form;

View File

@ -1,13 +1,12 @@
import { QueryFormDto, SortOrder } from '../dto/query-form.dto'; import { QueryFormDto, SortOrder } from '../dto/query-form.dto';
export class FormQueryBuilder { export class FormQueryBuilder {
// Build filter
static buildFilter(query: QueryFormDto): Record<string, unknown> { static buildFilter(query: QueryFormDto): Record<string, unknown> {
const filter: Record<string, unknown> = {}; const filter: Record<string, unknown> = {};
if (query.search) { if (query.search) {
filter.name = { $regex: query.search, $options: 'i' }; filter.name = { $regex: query.search, $options: 'i' };
} }
return filter; return filter;
} }