@punks/backend-entity-manager 0.0.493 → 0.0.494

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ export type StringFilter = {
22
22
  notIn?: string[];
23
23
  notLike?: string;
24
24
  isNull?: boolean;
25
+ isEmpty?: boolean;
25
26
  };
26
27
  export type IdFilter = {
27
28
  in?: string[];
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { Log, csvParse, excelParse, ExcelKeyTransform, excelBuild, csvBuild, map
2
2
  import { QueryCommand, ScanCommand, GetItemCommand, PutItemCommand, DeleteItemCommand, DynamoDBClient } from '@aws-sdk/client-dynamodb';
3
3
  import { unmarshall, marshall } from '@aws-sdk/util-dynamodb';
4
4
  import { Module, applyDecorators, Injectable, SetMetadata, createParamDecorator, Global, Scope, Inject, Logger, StreamableFile, HttpException, HttpStatus } from '@nestjs/common';
5
- import { MoreThanOrEqual, IsNull, And, Equal, Not, MoreThan, LessThanOrEqual, LessThan, ILike, Like, Between, In, Or, Repository } from 'typeorm';
5
+ import { MoreThanOrEqual, IsNull, And, Equal, Not, MoreThan, LessThanOrEqual, LessThan, ILike, Raw, Like, Between, In, Or, Repository } from 'typeorm';
6
6
  import { Reflector } from '@nestjs/core';
7
7
  import { AsyncLocalStorage } from 'async_hooks';
8
8
  import { hash } from 'bcrypt';
@@ -3699,6 +3699,12 @@ class QueryClauseBuilder {
3699
3699
  if (filter?.isNull === false) {
3700
3700
  clauses.push(Not(IsNull()));
3701
3701
  }
3702
+ if (filter?.isEmpty === true) {
3703
+ clauses.push(Raw((alias) => `TRIM(${alias}) IS NULL OR TRIM(${alias}) = ''`));
3704
+ }
3705
+ if (filter?.isEmpty === false) {
3706
+ clauses.push(Raw((alias) => `TRIM(${alias}) IS NOT NULL AND TRIM(${alias}) <> ''`));
3707
+ }
3702
3708
  return And(...clauses);
3703
3709
  }
3704
3710
  stringListFilter(filter) {