@hedhog/pagination 0.0.18 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,21 @@
|
|
1
|
-
import type {
|
1
|
+
import type { FindManyArgs, PaginationParams } from './types/pagination.types';
|
2
2
|
export declare class PaginationService {
|
3
3
|
private readonly logger;
|
4
4
|
private db;
|
5
|
-
paginate<T, M extends
|
6
|
-
total:
|
5
|
+
paginate<T, M extends any>(model: M, paginationParams: PaginationParams, customQuery?: FindManyArgs<M>, translationKey?: string): Promise<{
|
6
|
+
total: any;
|
7
7
|
lastPage: number;
|
8
8
|
page: number;
|
9
9
|
pageSize: number;
|
10
10
|
prev: number;
|
11
11
|
next: number;
|
12
|
-
data: any
|
12
|
+
data: any;
|
13
13
|
}>;
|
14
14
|
extractFieldNames(model: Record<string, any>): string[];
|
15
|
-
isInvalidField(sortField: string, model:
|
16
|
-
isInvalidLocaleField(sortField: string, model:
|
17
|
-
isInvalidFields(fields: string[], model:
|
18
|
-
isInvalidLocaleFields(fields: string[], model:
|
15
|
+
isInvalidField(sortField: string, model: any): boolean;
|
16
|
+
isInvalidLocaleField(sortField: string, model: any): boolean;
|
17
|
+
isInvalidFields(fields: string[], model: any): boolean;
|
18
|
+
isInvalidLocaleFields(fields: string[], model: any): boolean;
|
19
19
|
getDb(model: any): Promise<any>;
|
20
20
|
getBuilder(model: any, tableName: string, query: any, builder: any): Promise<any>;
|
21
21
|
query(model: any, query: any): Promise<any[]>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pagination.service.d.ts","sourceRoot":"","sources":["../src/pagination.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"pagination.service.d.ts","sourceRoot":"","sources":["../src/pagination.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,qBACa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAC7D,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@ -6,17 +6,13 @@ import {
|
|
6
6
|
} from './constants/pagination.constants';
|
7
7
|
import { AbstractDatabase, Database, DatabaseFactory } from './databases';
|
8
8
|
import { PageOrderDirection } from './enums/patination.enums';
|
9
|
-
import type {
|
10
|
-
BaseModel,
|
11
|
-
FindManyArgs,
|
12
|
-
PaginationParams,
|
13
|
-
} from './types/pagination.types';
|
9
|
+
import type { FindManyArgs, PaginationParams } from './types/pagination.types';
|
14
10
|
|
15
11
|
@Injectable()
|
16
12
|
export class PaginationService {
|
17
13
|
private readonly logger = new Logger(PaginationService.name);
|
18
14
|
private db: any = null;
|
19
|
-
async paginate<T, M extends
|
15
|
+
async paginate<T, M extends any>(
|
20
16
|
model: M,
|
21
17
|
paginationParams: PaginationParams,
|
22
18
|
customQuery?: FindManyArgs<M>,
|
@@ -62,7 +58,7 @@ export class PaginationService {
|
|
62
58
|
);
|
63
59
|
} else {
|
64
60
|
sortOrderCondition = {
|
65
|
-
[`${model.name}_locale`]: { [sortField]: sortOrder },
|
61
|
+
[`${(model as any).name}_locale`]: { [sortField]: sortOrder },
|
66
62
|
};
|
67
63
|
}
|
68
64
|
} else {
|
@@ -103,29 +99,29 @@ export class PaginationService {
|
|
103
99
|
const skip = page > 0 ? pageSize * (page - 1) : 0;
|
104
100
|
|
105
101
|
if (
|
106
|
-
customQuery.where &&
|
107
|
-
customQuery.where.OR &&
|
108
|
-
customQuery.where.OR.length === 0
|
102
|
+
(customQuery as any).where &&
|
103
|
+
(customQuery as any).where.OR &&
|
104
|
+
(customQuery as any).where.OR.length === 0
|
109
105
|
) {
|
110
|
-
delete customQuery.where.OR;
|
106
|
+
delete (customQuery as any).where.OR;
|
111
107
|
}
|
112
108
|
|
113
109
|
const query: any = {
|
114
110
|
select: selectCondition,
|
115
|
-
where: customQuery?.where || {},
|
111
|
+
where: (customQuery as any)?.where || {},
|
116
112
|
orderBy: sortOrderCondition,
|
117
113
|
take: pageSize,
|
118
114
|
skip,
|
119
115
|
};
|
120
116
|
|
121
|
-
if (customQuery?.include) {
|
122
|
-
query.include = customQuery?.include;
|
117
|
+
if ((customQuery as any)?.include) {
|
118
|
+
query.include = (customQuery as any)?.include;
|
123
119
|
delete query.select;
|
124
120
|
}
|
125
121
|
|
126
122
|
let [total, data] = await Promise.all([
|
127
|
-
model.count({ where: customQuery?.where || {} }),
|
128
|
-
model.findMany(query),
|
123
|
+
(model as any).count({ where: (customQuery as any)?.where || {} }),
|
124
|
+
(model as any).findMany(query),
|
129
125
|
//this.query(model, query),
|
130
126
|
]);
|
131
127
|
|
@@ -169,23 +165,23 @@ export class PaginationService {
|
|
169
165
|
return fieldNames;
|
170
166
|
}
|
171
167
|
|
172
|
-
isInvalidField(sortField: string, model:
|
168
|
+
isInvalidField(sortField: string, model: any): boolean {
|
173
169
|
return model && model.fields ? !model.fields[sortField] : true;
|
174
170
|
}
|
175
171
|
|
176
|
-
isInvalidLocaleField(sortField: string, model:
|
172
|
+
isInvalidLocaleField(sortField: string, model: any): boolean {
|
177
173
|
const fields = model['$parent'][`${model.name}_locale`].fields;
|
178
174
|
|
179
175
|
return model && fields ? !fields[sortField] : true;
|
180
176
|
}
|
181
177
|
|
182
|
-
isInvalidFields(fields: string[], model:
|
178
|
+
isInvalidFields(fields: string[], model: any): boolean {
|
183
179
|
return !fields.every((field) =>
|
184
180
|
model.fields ? model && model.fields[field] : false,
|
185
181
|
);
|
186
182
|
}
|
187
183
|
|
188
|
-
isInvalidLocaleFields(fields: string[], model:
|
184
|
+
isInvalidLocaleFields(fields: string[], model: any): boolean {
|
189
185
|
const localeFields = model['$parent'][`${model.name}_locale`].fields;
|
190
186
|
|
191
187
|
return !fields.every((field) =>
|