@punks/backend-entity-manager 0.0.95 → 0.0.97
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.
- package/dist/cjs/index.js +81 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/__test__/entity/foo.d.ts +1 -1
- package/dist/cjs/types/__test__/providers/typeorm/converter/foo.d.ts +9 -0
- package/dist/cjs/types/__test__/providers/typeorm/entity/foo.d.ts +1 -83
- package/dist/cjs/types/__test__/providers/typeorm/init/foo.d.ts +6 -0
- package/dist/cjs/types/__test__/providers/typeorm/manager/foo.d.ts +4 -0
- package/dist/cjs/types/__test__/providers/typeorm/models/foo.d.ts +56 -0
- package/dist/cjs/types/__test__/providers/typeorm/queries/foo.d.ts +12 -0
- package/dist/cjs/types/__test__/providers/typeorm/repository/foo.d.ts +6 -0
- package/dist/cjs/types/__test__/providers/typeorm/serializer/foo.d.ts +6 -0
- package/dist/cjs/types/integrations/repository/typeorm/clause.d.ts +32 -0
- package/dist/cjs/types/integrations/repository/typeorm/queryBuilder.d.ts +2 -0
- package/dist/cjs/types/integrations/repository/typeorm/queryClauseBuilder.d.ts +8 -0
- package/dist/esm/index.js +82 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/__test__/entity/foo.d.ts +1 -1
- package/dist/esm/types/__test__/providers/typeorm/converter/foo.d.ts +9 -0
- package/dist/esm/types/__test__/providers/typeorm/entity/foo.d.ts +1 -83
- package/dist/esm/types/__test__/providers/typeorm/init/foo.d.ts +6 -0
- package/dist/esm/types/__test__/providers/typeorm/manager/foo.d.ts +4 -0
- package/dist/esm/types/__test__/providers/typeorm/models/foo.d.ts +56 -0
- package/dist/esm/types/__test__/providers/typeorm/queries/foo.d.ts +12 -0
- package/dist/esm/types/__test__/providers/typeorm/repository/foo.d.ts +6 -0
- package/dist/esm/types/__test__/providers/typeorm/serializer/foo.d.ts +6 -0
- package/dist/esm/types/integrations/repository/typeorm/clause.d.ts +32 -0
- package/dist/esm/types/integrations/repository/typeorm/queryBuilder.d.ts +2 -0
- package/dist/esm/types/integrations/repository/typeorm/queryClauseBuilder.d.ts +8 -0
- package/dist/index.d.ts +42 -1
- package/package.json +1 -1
|
@@ -6,9 +6,9 @@ import { IEntitiesSearchResults } from "../../models";
|
|
|
6
6
|
import { EntityServiceLocator } from "../../providers/services";
|
|
7
7
|
import { InMemoryRepository } from "../../testing/mocks/repository";
|
|
8
8
|
import { EntitySerializerSheetDefinition, IAuthenticationContext, IEntityManager } from "../../abstractions";
|
|
9
|
-
import { FooDeleteParameters } from "../providers/typeorm/entity/foo";
|
|
10
9
|
import { IEntitiesDeleteResult } from "../../abstractions/repository";
|
|
11
10
|
import { EntitySerializer } from "../../base";
|
|
11
|
+
import { FooDeleteParameters } from "../providers/typeorm/models/foo";
|
|
12
12
|
export interface FooEntity {
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IEntityConverter } from "../../../../abstractions";
|
|
2
|
+
import { FooEntity } from "../entity/foo";
|
|
3
|
+
import { FooCreateInput, FooDto, FooListItemDto, FooUpdateInput } from "../models/foo";
|
|
4
|
+
export declare class FooConverter implements IEntityConverter<FooEntity, FooDto, FooListItemDto, FooCreateInput, FooUpdateInput> {
|
|
5
|
+
toListItemDto(entity: FooEntity): FooListItemDto;
|
|
6
|
+
toEntityDto(entity: FooEntity): FooDto;
|
|
7
|
+
createDtoToEntity(input: FooCreateInput): Partial<FooEntity>;
|
|
8
|
+
updateDtoToEntity(input: FooUpdateInput): Partial<FooEntity>;
|
|
9
|
+
}
|
|
@@ -1,89 +1,7 @@
|
|
|
1
|
-
import { DataSource, Repository, FindOptionsWhere } from "typeorm";
|
|
2
|
-
import { EntitySerializerSheetDefinition, IAuthenticationContext, IEntityConverter, IEntityManager, IEntityManagerServiceRoot, IEntitySearchParameters, ISearchSorting, ISearchSortingField, SortDirection } from "../../../../abstractions";
|
|
3
|
-
import { TypeOrmRepository } from "../../../../integrations/repository/typeorm";
|
|
4
|
-
import { EntityServiceLocator } from "../../../../providers/services";
|
|
5
|
-
import { TypeOrmQueryBuilder } from "../../../../integrations/repository/typeorm";
|
|
6
|
-
import { IEntitiesDeleteParameters } from "../../../../abstractions/commands";
|
|
7
|
-
import { EntitySerializer } from "../../../../base";
|
|
8
1
|
export declare class FooEntity {
|
|
9
2
|
id: string;
|
|
10
3
|
name: string;
|
|
11
4
|
age: number;
|
|
5
|
+
enabled: boolean;
|
|
12
6
|
updatedOn: Date;
|
|
13
7
|
}
|
|
14
|
-
export type FooEntityManager = IEntityManager<FooEntity, string, Partial<FooEntity>, Partial<FooEntity>, FooDeleteParameters, FooSearchParameters, FooSorting, FooCursor, FooFacets>;
|
|
15
|
-
export declare class FooTypeOrmRepo extends TypeOrmRepository<FooEntity, string> {
|
|
16
|
-
constructor(repository: Repository<FooEntity>);
|
|
17
|
-
}
|
|
18
|
-
export interface FooSearchFilters {
|
|
19
|
-
minAge?: number;
|
|
20
|
-
maxAge?: number;
|
|
21
|
-
}
|
|
22
|
-
export declare enum FooSorting {
|
|
23
|
-
Name = "Name",
|
|
24
|
-
Age = "Age"
|
|
25
|
-
}
|
|
26
|
-
export type FooCursor = number;
|
|
27
|
-
export interface FooSearchParameters extends IEntitySearchParameters<FooSorting, FooCursor> {
|
|
28
|
-
filters?: FooSearchFilters;
|
|
29
|
-
}
|
|
30
|
-
export interface FooSearchSortingField extends ISearchSortingField<FooSorting> {
|
|
31
|
-
field: FooSorting;
|
|
32
|
-
direction: SortDirection;
|
|
33
|
-
}
|
|
34
|
-
export interface FooQuerySorting extends ISearchSorting<FooSorting> {
|
|
35
|
-
fields: FooSearchSortingField[];
|
|
36
|
-
}
|
|
37
|
-
export interface FooDeleteParameters extends IEntitiesDeleteParameters<FooSorting> {
|
|
38
|
-
filters?: FooSearchFilters;
|
|
39
|
-
sorting?: FooQuerySorting;
|
|
40
|
-
}
|
|
41
|
-
export interface FooFacets {
|
|
42
|
-
}
|
|
43
|
-
export declare class FooQueryBuilder extends TypeOrmQueryBuilder<FooEntity, FooSearchParameters, FooSorting, FooFacets, unknown> {
|
|
44
|
-
constructor(services: EntityServiceLocator<FooEntity, string>);
|
|
45
|
-
protected buildContextFilter(context?: IAuthenticationContext<unknown> | undefined): FindOptionsWhere<FooEntity> | FindOptionsWhere<FooEntity>[];
|
|
46
|
-
protected buildWhereClause(request: FooSearchParameters): FindOptionsWhere<FooEntity> | FindOptionsWhere<FooEntity>[];
|
|
47
|
-
private buildAgeWhereClause;
|
|
48
|
-
protected calculateFacets(request: FooSearchParameters): Promise<FooFacets | undefined>;
|
|
49
|
-
}
|
|
50
|
-
export interface FooDto {
|
|
51
|
-
id: string;
|
|
52
|
-
profile: {
|
|
53
|
-
name: string;
|
|
54
|
-
age: number;
|
|
55
|
-
};
|
|
56
|
-
updatedOn: Date;
|
|
57
|
-
}
|
|
58
|
-
export interface FooListItemDto {
|
|
59
|
-
id: string;
|
|
60
|
-
profile: {
|
|
61
|
-
name: string;
|
|
62
|
-
age: number;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export interface FooCreateInput {
|
|
66
|
-
profile: {
|
|
67
|
-
name: string;
|
|
68
|
-
age: number;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export interface FooUpdateInput {
|
|
72
|
-
id: string;
|
|
73
|
-
profile: {
|
|
74
|
-
name: string;
|
|
75
|
-
age: number;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export declare class FooConverter implements IEntityConverter<FooEntity, FooDto, FooListItemDto, FooCreateInput, FooUpdateInput> {
|
|
79
|
-
toListItemDto(entity: FooEntity): FooListItemDto;
|
|
80
|
-
toEntityDto(entity: FooEntity): FooDto;
|
|
81
|
-
createDtoToEntity(input: FooCreateInput): Partial<FooEntity>;
|
|
82
|
-
updateDtoToEntity(input: FooUpdateInput): Partial<FooEntity>;
|
|
83
|
-
}
|
|
84
|
-
export declare class FooSerializer extends EntitySerializer<FooEntity, string> {
|
|
85
|
-
protected getDefinition(): EntitySerializerSheetDefinition<FooEntity>;
|
|
86
|
-
}
|
|
87
|
-
export declare const registerFooTypeOrmEntity: (container: IEntityManagerServiceRoot, dataSource: DataSource, options?: {
|
|
88
|
-
useConverter?: boolean;
|
|
89
|
-
}) => import("../../../../abstractions").IEntityManagerServiceCollection<FooEntity, string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataSource } from "typeorm";
|
|
2
|
+
import { IEntityManagerServiceRoot } from "../../../../abstractions";
|
|
3
|
+
import { FooEntity } from "../entity/foo";
|
|
4
|
+
export declare const registerFooTypeOrmEntity: (container: IEntityManagerServiceRoot, dataSource: DataSource, options?: {
|
|
5
|
+
useConverter?: boolean;
|
|
6
|
+
}) => import("../../../../abstractions").IEntityManagerServiceCollection<FooEntity, string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IEntityManager } from "../../../../abstractions/manager";
|
|
2
|
+
import { FooEntity } from "../entity/foo";
|
|
3
|
+
import { FooCursor, FooDeleteParameters, FooFacets, FooSearchParameters, FooSorting } from "../models/foo";
|
|
4
|
+
export type FooEntityManager = IEntityManager<FooEntity, string, Partial<FooEntity>, Partial<FooEntity>, FooDeleteParameters, FooSearchParameters, FooSorting, FooCursor, FooFacets>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IEntitiesDeleteParameters, IEntitySearchParameters, ISearchSorting, ISearchSortingField, SortDirection } from "../../../../abstractions";
|
|
2
|
+
import { BooleanFilter, NumericFilter, StringFilter } from "../../../../integrations/repository/typeorm/clause";
|
|
3
|
+
export interface FooSearchFilters {
|
|
4
|
+
age?: NumericFilter;
|
|
5
|
+
name?: StringFilter;
|
|
6
|
+
enabled?: BooleanFilter;
|
|
7
|
+
}
|
|
8
|
+
export declare enum FooSorting {
|
|
9
|
+
Name = "Name",
|
|
10
|
+
Age = "Age"
|
|
11
|
+
}
|
|
12
|
+
export type FooCursor = number;
|
|
13
|
+
export interface FooSearchParameters extends IEntitySearchParameters<FooSorting, FooCursor> {
|
|
14
|
+
filters?: FooSearchFilters;
|
|
15
|
+
}
|
|
16
|
+
export interface FooSearchSortingField extends ISearchSortingField<FooSorting> {
|
|
17
|
+
field: FooSorting;
|
|
18
|
+
direction: SortDirection;
|
|
19
|
+
}
|
|
20
|
+
export interface FooQuerySorting extends ISearchSorting<FooSorting> {
|
|
21
|
+
fields: FooSearchSortingField[];
|
|
22
|
+
}
|
|
23
|
+
export interface FooDeleteParameters extends IEntitiesDeleteParameters<FooSorting> {
|
|
24
|
+
filters?: FooSearchFilters;
|
|
25
|
+
sorting?: FooQuerySorting;
|
|
26
|
+
}
|
|
27
|
+
export interface FooFacets {
|
|
28
|
+
}
|
|
29
|
+
export interface FooDto {
|
|
30
|
+
id: string;
|
|
31
|
+
profile: {
|
|
32
|
+
name: string;
|
|
33
|
+
age: number;
|
|
34
|
+
};
|
|
35
|
+
updatedOn: Date;
|
|
36
|
+
}
|
|
37
|
+
export interface FooListItemDto {
|
|
38
|
+
id: string;
|
|
39
|
+
profile: {
|
|
40
|
+
name: string;
|
|
41
|
+
age: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface FooCreateInput {
|
|
45
|
+
profile: {
|
|
46
|
+
name: string;
|
|
47
|
+
age: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface FooUpdateInput {
|
|
51
|
+
id: string;
|
|
52
|
+
profile: {
|
|
53
|
+
name: string;
|
|
54
|
+
age: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FindOptionsWhere } from "typeorm";
|
|
2
|
+
import { IAuthenticationContext } from "../../../../abstractions";
|
|
3
|
+
import { TypeOrmQueryBuilder } from "../../../../integrations";
|
|
4
|
+
import { EntityServiceLocator } from "../../../../providers/services";
|
|
5
|
+
import { FooEntity } from "../entity/foo";
|
|
6
|
+
import { FooFacets, FooSearchParameters, FooSorting } from "../models/foo";
|
|
7
|
+
export declare class FooQueryBuilder extends TypeOrmQueryBuilder<FooEntity, FooSearchParameters, FooSorting, FooFacets, unknown> {
|
|
8
|
+
constructor(services: EntityServiceLocator<FooEntity, string>);
|
|
9
|
+
protected buildContextFilter(context?: IAuthenticationContext<unknown> | undefined): FindOptionsWhere<FooEntity> | FindOptionsWhere<FooEntity>[];
|
|
10
|
+
protected buildWhereClause(request: FooSearchParameters): FindOptionsWhere<FooEntity> | FindOptionsWhere<FooEntity>[];
|
|
11
|
+
protected calculateFacets(request: FooSearchParameters): Promise<FooFacets | undefined>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Repository } from "typeorm";
|
|
2
|
+
import { TypeOrmRepository } from "../../../../integrations";
|
|
3
|
+
import { FooEntity } from "../entity/foo";
|
|
4
|
+
export declare class FooTypeOrmRepo extends TypeOrmRepository<FooEntity, string> {
|
|
5
|
+
constructor(repository: Repository<FooEntity>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EntitySerializerSheetDefinition } from "../../../../abstractions";
|
|
2
|
+
import { EntitySerializer } from "../../../../base";
|
|
3
|
+
import { FooEntity } from "../entity/foo";
|
|
4
|
+
export declare class FooSerializer extends EntitySerializer<FooEntity, string> {
|
|
5
|
+
protected getDefinition(): EntitySerializerSheetDefinition<FooEntity>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type NumericFilter = {
|
|
2
|
+
in?: number[];
|
|
3
|
+
eq?: number;
|
|
4
|
+
gt?: number;
|
|
5
|
+
gte?: number;
|
|
6
|
+
lt?: number;
|
|
7
|
+
lte?: number;
|
|
8
|
+
};
|
|
9
|
+
export type StringFilter = {
|
|
10
|
+
gt?: string;
|
|
11
|
+
gte?: string;
|
|
12
|
+
lt?: string;
|
|
13
|
+
lte?: string;
|
|
14
|
+
in?: string[];
|
|
15
|
+
eq?: string;
|
|
16
|
+
like?: string;
|
|
17
|
+
ne?: string;
|
|
18
|
+
notIn?: string[];
|
|
19
|
+
notLike?: string;
|
|
20
|
+
};
|
|
21
|
+
export type BooleanFilter = {
|
|
22
|
+
eq?: boolean;
|
|
23
|
+
ne?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type DateFilter = {
|
|
26
|
+
in?: Date[];
|
|
27
|
+
eq?: Date;
|
|
28
|
+
gt?: Date;
|
|
29
|
+
gte?: Date;
|
|
30
|
+
lt?: Date;
|
|
31
|
+
lte?: Date;
|
|
32
|
+
};
|
|
@@ -5,9 +5,11 @@ import { QueryBuilderBase } from "../../../templates";
|
|
|
5
5
|
import { TypeOrmRepository } from "./repository";
|
|
6
6
|
import { EntityServiceLocator } from "../../../providers/services";
|
|
7
7
|
import { IEntitiesDeleteResult } from "../../../abstractions/repository";
|
|
8
|
+
import { QueryClauseBuilder } from "./queryClauseBuilder";
|
|
8
9
|
export declare abstract class TypeOrmQueryBuilder<TEntity extends ObjectLiteral, TEntitySearchParameters extends IEntitySearchParameters<TSorting, number>, TSorting extends SortingType, TFacets extends IEntityFacets, TUserContext> extends QueryBuilderBase<TEntity, TEntitySearchParameters, TSorting, number, TFacets, TUserContext> {
|
|
9
10
|
private readonly services;
|
|
10
11
|
private repository;
|
|
12
|
+
protected clause: QueryClauseBuilder;
|
|
11
13
|
constructor(services: EntityServiceLocator<TEntity, unknown>);
|
|
12
14
|
exists(filters: NonNullable<TEntitySearchParameters["filters"]>, context?: IAuthenticationContext<TUserContext> | undefined): Promise<boolean>;
|
|
13
15
|
count(filters: NonNullable<TEntitySearchParameters["filters"]>, context?: IAuthenticationContext<TUserContext> | undefined): Promise<number>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FindOperator } from "typeorm";
|
|
2
|
+
import { BooleanFilter, DateFilter, NumericFilter, StringFilter } from "./clause";
|
|
3
|
+
export declare class QueryClauseBuilder {
|
|
4
|
+
stringFilter(filter: StringFilter): FindOperator<string>;
|
|
5
|
+
numericFilter(filter: NumericFilter): FindOperator<number>;
|
|
6
|
+
dateFilter(filter: DateFilter): FindOperator<Date>;
|
|
7
|
+
boolFilter(filter: BooleanFilter): FindOperator<boolean>;
|
|
8
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { STATIC_CONTEXT } from '@nestjs/core/injector/constants';
|
|
|
9
9
|
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
|
10
10
|
import { JwtService, JwtModule } from '@nestjs/jwt';
|
|
11
11
|
import { EventEmitter2, EventEmitterModule } from '@nestjs/event-emitter';
|
|
12
|
-
import { In } from 'typeorm';
|
|
12
|
+
import { MoreThanOrEqual, MoreThan, LessThanOrEqual, LessThan, In, Equal, Like, Not, And } from 'typeorm';
|
|
13
13
|
import { ListObjectsCommand, PutObjectCommand, GetObjectCommand, DeleteObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
|
14
14
|
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
15
15
|
import { SendEmailCommand, SESClient } from '@aws-sdk/client-ses';
|
|
@@ -145,7 +145,7 @@ class EntitySerializer {
|
|
|
145
145
|
}
|
|
146
146
|
convertSheetRecord(record) {
|
|
147
147
|
if (!record._type || record._type !== this.entityName) {
|
|
148
|
-
throw new Error(`Invalid record type ${record._type}`);
|
|
148
|
+
throw new Error(`Invalid record type ${record._type} -> record: \n${JSON.stringify(record)}`);
|
|
149
149
|
}
|
|
150
150
|
const definition = this.getDefinition();
|
|
151
151
|
const entity = {};
|
|
@@ -21434,10 +21434,90 @@ class QueryBuilderBase {
|
|
|
21434
21434
|
}
|
|
21435
21435
|
}
|
|
21436
21436
|
|
|
21437
|
+
class QueryClauseBuilder {
|
|
21438
|
+
stringFilter(filter) {
|
|
21439
|
+
const clauses = [];
|
|
21440
|
+
if (!!filter?.gte) {
|
|
21441
|
+
clauses.push(MoreThanOrEqual(filter.gte));
|
|
21442
|
+
}
|
|
21443
|
+
if (!!filter?.gt) {
|
|
21444
|
+
clauses.push(MoreThan(filter.gt));
|
|
21445
|
+
}
|
|
21446
|
+
if (!!filter?.lte) {
|
|
21447
|
+
clauses.push(LessThanOrEqual(filter.lte));
|
|
21448
|
+
}
|
|
21449
|
+
if (!!filter?.lt) {
|
|
21450
|
+
clauses.push(LessThan(filter.lt));
|
|
21451
|
+
}
|
|
21452
|
+
if (!!filter?.in) {
|
|
21453
|
+
clauses.push(In(filter.in));
|
|
21454
|
+
}
|
|
21455
|
+
if (!!filter?.eq) {
|
|
21456
|
+
clauses.push(Equal(filter.eq));
|
|
21457
|
+
}
|
|
21458
|
+
if (!!filter?.like) {
|
|
21459
|
+
clauses.push(Like(filter.like.replaceAll("*", "%")));
|
|
21460
|
+
}
|
|
21461
|
+
if (!!filter?.ne) {
|
|
21462
|
+
clauses.push(Not(Equal(filter.ne)));
|
|
21463
|
+
}
|
|
21464
|
+
if (!!filter?.notIn) {
|
|
21465
|
+
clauses.push(Not(In(filter.notIn)));
|
|
21466
|
+
}
|
|
21467
|
+
if (!!filter?.notLike) {
|
|
21468
|
+
clauses.push(Not(Like(filter.notLike.replaceAll("*", "%"))));
|
|
21469
|
+
}
|
|
21470
|
+
return And(...clauses);
|
|
21471
|
+
}
|
|
21472
|
+
numericFilter(filter) {
|
|
21473
|
+
const clauses = [];
|
|
21474
|
+
if (!!filter?.gte) {
|
|
21475
|
+
clauses.push(MoreThanOrEqual(filter.gte));
|
|
21476
|
+
}
|
|
21477
|
+
if (!!filter?.gt) {
|
|
21478
|
+
clauses.push(MoreThan(filter.gt));
|
|
21479
|
+
}
|
|
21480
|
+
if (!!filter?.lte) {
|
|
21481
|
+
clauses.push(LessThanOrEqual(filter.lte));
|
|
21482
|
+
}
|
|
21483
|
+
if (!!filter?.lt) {
|
|
21484
|
+
clauses.push(LessThan(filter.lt));
|
|
21485
|
+
}
|
|
21486
|
+
return And(...clauses);
|
|
21487
|
+
}
|
|
21488
|
+
dateFilter(filter) {
|
|
21489
|
+
const clauses = [];
|
|
21490
|
+
if (!!filter?.gte) {
|
|
21491
|
+
clauses.push(MoreThanOrEqual(filter.gte));
|
|
21492
|
+
}
|
|
21493
|
+
if (!!filter?.gt) {
|
|
21494
|
+
clauses.push(MoreThan(filter.gt));
|
|
21495
|
+
}
|
|
21496
|
+
if (!!filter?.lte) {
|
|
21497
|
+
clauses.push(LessThanOrEqual(filter.lte));
|
|
21498
|
+
}
|
|
21499
|
+
if (!!filter?.lt) {
|
|
21500
|
+
clauses.push(LessThan(filter.lt));
|
|
21501
|
+
}
|
|
21502
|
+
return And(...clauses);
|
|
21503
|
+
}
|
|
21504
|
+
boolFilter(filter) {
|
|
21505
|
+
const clauses = [];
|
|
21506
|
+
if (!isNullOrUndefined(filter?.eq)) {
|
|
21507
|
+
clauses.push(Equal(filter.eq));
|
|
21508
|
+
}
|
|
21509
|
+
if (!isNullOrUndefined(filter?.ne)) {
|
|
21510
|
+
clauses.push(Not(Equal(filter.ne)));
|
|
21511
|
+
}
|
|
21512
|
+
return And(...clauses);
|
|
21513
|
+
}
|
|
21514
|
+
}
|
|
21515
|
+
|
|
21437
21516
|
class TypeOrmQueryBuilder extends QueryBuilderBase {
|
|
21438
21517
|
constructor(services) {
|
|
21439
21518
|
super();
|
|
21440
21519
|
this.services = services;
|
|
21520
|
+
this.clause = new QueryClauseBuilder();
|
|
21441
21521
|
}
|
|
21442
21522
|
async exists(filters, context) {
|
|
21443
21523
|
return (await this.count(filters, context)) > 0;
|