add test case

This commit is contained in:
2025-05-30 22:11:40 +08:00
parent e26cb841fc
commit 88447f0db6
2 changed files with 16 additions and 18 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
import { ArgumentMetadata, BadRequestException, Paramtype, ValidationPipe } from '@nestjs/common';
import { isObject, omit } from 'lodash';
import { isNil, isObject, isString, omit } from 'lodash';
import { DTO_VALIDATION_OPTIONS } from '../contants';
import { deepMerge } from '../helpers';
@@ -31,6 +31,9 @@ export class AppPipe extends ValidationPipe {
if (isObject(val) && 'mimetype' in val) {
return [key, omit(val, ['fields'])];
}
if (key === 'name' && isString(val)) {
return [key, isNil(val) ? val : val.trim()];
}
return [key, val];
}),
)