@provis/provis-common-be-module 2.1.3 → 2.2.0
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.
|
@@ -2,7 +2,7 @@ import { DeepPartial, FindConditions, Repository } from 'typeorm';
|
|
|
2
2
|
import ISearchQuery from '../interface/search.query.interface';
|
|
3
3
|
import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity';
|
|
4
4
|
import IFindAllCount from '../interface/find.all.count.interface';
|
|
5
|
-
import
|
|
5
|
+
import ISearchSummary from '../interface/search.summary.interface';
|
|
6
6
|
export declare class MainRepository<T> extends Repository<T> {
|
|
7
7
|
saveRepo(data: DeepPartial<T>): Promise<T>;
|
|
8
8
|
updateRepo(obj: DeepPartial<T>, updated: QueryDeepPartialEntity<T>): Promise<T>;
|
|
@@ -16,7 +16,7 @@ export declare class MainRepository<T> extends Repository<T> {
|
|
|
16
16
|
orderDirection: 'ASC' | 'DESC';
|
|
17
17
|
};
|
|
18
18
|
searchBracket(searchOr: any[], searchValues: (value: any) => Promise<ISearchQuery[]>): Promise<ISearchQuery[][]>;
|
|
19
|
-
summaryField(
|
|
19
|
+
summaryField({ fieldToSum, search, additionalSearchOr, relations, }: ISearchSummary): Promise<any>;
|
|
20
20
|
findAllAndCount({ search, additionalSearchOr, relations, sortBy, offset, maxCount, }: IFindAllCount): Promise<[number, T[]]>;
|
|
21
21
|
private applySearchConditions;
|
|
22
22
|
private generateRawCount;
|
|
@@ -116,7 +116,7 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
116
116
|
return result;
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
summaryField(search,
|
|
119
|
+
summaryField({ fieldToSum, search, additionalSearchOr, relations, }) {
|
|
120
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
121
|
let query = this.createQueryBuilder()
|
|
122
122
|
.select([
|
|
@@ -127,6 +127,7 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
127
127
|
query,
|
|
128
128
|
search,
|
|
129
129
|
additionalSearchOr,
|
|
130
|
+
relations,
|
|
130
131
|
});
|
|
131
132
|
return query.getRawOne();
|
|
132
133
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import IMultiJoin from "./multi.join.interface";
|
|
2
|
+
import ISearchQuery from "./search.query.interface";
|
|
3
|
+
import ISummaryField from "./summary.field.interface";
|
|
4
|
+
export default interface ISearchSummary {
|
|
5
|
+
fieldToSum: ISummaryField[];
|
|
6
|
+
search: ISearchQuery[];
|
|
7
|
+
additionalSearchOr?: ISearchQuery[][];
|
|
8
|
+
relations?: IMultiJoin[];
|
|
9
|
+
}
|