adjusted filter in find form
This commit is contained in:
parent
2079f3873c
commit
5cddfb43de
@ -84,7 +84,7 @@ export class FormService {
|
||||
async find(formId: string): Promise<Form> {
|
||||
const form = await this.formModel
|
||||
.findOne({ id: formId, deletedAt: null })
|
||||
.select(LIST_PROJECTION)
|
||||
.select(DETAIL_PROJECTION)
|
||||
.exec();
|
||||
if (!form) throw new NotFoundException(`Form ${formId} not found`);
|
||||
return form;
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import { QueryFormDto, SortOrder } from '../dto/query-form.dto';
|
||||
|
||||
export class FormQueryBuilder {
|
||||
// Build filter
|
||||
static buildFilter(query: QueryFormDto): Record<string, unknown> {
|
||||
const filter: Record<string, unknown> = {};
|
||||
|
||||
if (query.search) {
|
||||
filter.name = { $regex: query.search, $options: 'i' };
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user