From 73d90204556aff005aefcaabcb2217d55cba6abb Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Tue, 24 Sep 2024 08:02:32 +0100 Subject: [PATCH] fix: feedback updates --- api/migrations/config/create.ts | 4 ++-- api/src/utils/pipes/search-filter.pipe.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/migrations/config/create.ts b/api/migrations/config/create.ts index 8c1b923f..09a8e103 100644 --- a/api/migrations/config/create.ts +++ b/api/migrations/config/create.ts @@ -11,7 +11,7 @@ import fs from 'fs'; import path from 'path'; -import _ from 'lodash'; +import escapeRegExp from 'lodash/escapeRegExp'; // Get the argument passed (e.g., "all-users-fr") const arg: string | undefined = process.argv[2]; @@ -27,7 +27,7 @@ const templatePath: string = path.join(__dirname, '../config/template.ts'); // Check if a migration with the same name (excluding timestamp) already exists const migrationExists: boolean = fs.readdirSync(migrationsDir).some((file) => { - const regex = new RegExp(`^[0-9]+-${_.escapeRegExp(arg)}\\.ts$`); + const regex = new RegExp(`^[0-9]+-${escapeRegExp(arg)}\\.ts$`); return regex.test(file); }); diff --git a/api/src/utils/pipes/search-filter.pipe.ts b/api/src/utils/pipes/search-filter.pipe.ts index 6ba8c916..b944338f 100644 --- a/api/src/utils/pipes/search-filter.pipe.ts +++ b/api/src/utils/pipes/search-filter.pipe.ts @@ -13,7 +13,7 @@ import { ArgumentMetadata, Logger, } from '@nestjs/common'; -import _ from 'lodash'; +import escapeRegExp from 'lodash/escapeRegExp'; import { TFilterQuery, Types } from 'mongoose'; import { @@ -37,7 +37,7 @@ export class SearchFilterPipe } private getRegexValue(val: string) { - const escapedRegExp = _.escapeRegExp(val); + const escapedRegExp = escapeRegExp(val); return new RegExp(escapedRegExp, 'i'); }