@punks/backend-entity-manager 0.0.361 → 0.0.362

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.
@@ -53,3 +53,9 @@ export type DateFilter = {
53
53
  lte?: Date;
54
54
  isNull?: boolean;
55
55
  };
56
+ export type StringListFilter = {
57
+ contains?: string;
58
+ iContains?: string;
59
+ notContains?: string;
60
+ iNotContains?: string;
61
+ };
@@ -1,9 +1,10 @@
1
1
  import { FindOperator } from "typeorm";
2
- import { BooleanFilter, DateFilter, EnumFilter, IdFilter, NumericFilter, StringFilter } from "./clause";
2
+ import { BooleanFilter, DateFilter, EnumFilter, IdFilter, NumericFilter, StringFilter, StringListFilter } from "./clause";
3
3
  export declare class QueryClauseBuilder {
4
4
  enumFilter<T>(filter: EnumFilter<T>): FindOperator<T>;
5
5
  idFilter(filter: IdFilter): FindOperator<string>;
6
6
  stringFilter(filter: StringFilter): FindOperator<string>;
7
+ stringListFilter(filter: StringListFilter): FindOperator<string>;
7
8
  numericFilter(filter: NumericFilter): FindOperator<number>;
8
9
  dateFilter(filter: DateFilter): FindOperator<Date>;
9
10
  boolFilter(filter: BooleanFilter): FindOperator<boolean>;
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { Log, csvParse, excelParse, excelBuild, csvBuild, mapAsync, isNullOrUnde
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, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, In, Or, Repository } from 'typeorm';
5
+ import { MoreThanOrEqual, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like, 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';
@@ -3566,6 +3566,16 @@ class QueryClauseBuilder {
3566
3566
  }
3567
3567
  return And(...clauses);
3568
3568
  }
3569
+ stringListFilter(filter) {
3570
+ const clauses = [];
3571
+ if (!isNullOrUndefined(filter?.contains)) {
3572
+ clauses.push(Like(`%${filter.contains}%`));
3573
+ }
3574
+ if (!isNullOrUndefined(filter?.iContains)) {
3575
+ clauses.push(ILike(`%${filter.iContains}%`));
3576
+ }
3577
+ return And(...clauses);
3578
+ }
3569
3579
  numericFilter(filter) {
3570
3580
  const clauses = [];
3571
3581
  if (!isNullOrUndefined(filter?.gte)) {