c2-mongoose 2.1.152 → 2.1.153
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/flow/item/GetStagePaginationFlowItem.d.ts +7 -0
- package/dist/flow/item/GetStagePaginationFlowItem.js +20 -0
- package/dist/index.d.ts +2 -1
- package/dist/model/Facet.d.ts +13 -0
- package/dist/model/Facet.js +2 -0
- package/package.json +1 -1
- package/src/flow/item/GetStagePaginationFlowItem.ts +23 -0
- package/src/index.ts +2 -1
- package/src/model/Facet.ts +15 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var GetStagePaginationFlowItem = /** @class */ (function () {
|
|
4
|
+
function GetStagePaginationFlowItem() {
|
|
5
|
+
}
|
|
6
|
+
GetStagePaginationFlowItem.prototype.get = function (facet, searcher) {
|
|
7
|
+
var facetAfter = facet;
|
|
8
|
+
if (searcher.pageable === true) {
|
|
9
|
+
facetAfter.items.push({ $skip: ((searcher.page - 1) * searcher.limit) || 0 });
|
|
10
|
+
facetAfter.items.push({ $limit: searcher.limit });
|
|
11
|
+
facetAfter.paging = [
|
|
12
|
+
{ $count: "total" },
|
|
13
|
+
{ $addFields: { page: searcher.page || 1, limit: searcher.limit } }
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
return facetAfter;
|
|
17
|
+
};
|
|
18
|
+
return GetStagePaginationFlowItem;
|
|
19
|
+
}());
|
|
20
|
+
exports.default = new GetStagePaginationFlowItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import CrudFlow from "./flow/CrudFlow";
|
|
|
3
3
|
import SearchFlow from "./flow/SearchFlow";
|
|
4
4
|
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem";
|
|
5
5
|
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem";
|
|
6
|
+
import { IFacet } from "./model/Facet";
|
|
6
7
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger";
|
|
7
8
|
import { Options } from "./types/Options";
|
|
8
9
|
import { Pagination, SearchResponse } from "./types/SearchResponse";
|
|
9
10
|
import { initialize } from "./utils/Utils";
|
|
10
|
-
export { C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem };
|
|
11
|
+
export { C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet };
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IFacet } from "../../model/Facet"
|
|
2
|
+
import SearchFlow from "../SearchFlow"
|
|
3
|
+
|
|
4
|
+
class GetStagePaginationFlowItem {
|
|
5
|
+
|
|
6
|
+
get(facet: IFacet, searcher: SearchFlow): IFacet {
|
|
7
|
+
let facetAfter: IFacet = facet
|
|
8
|
+
|
|
9
|
+
if (searcher.pageable === true) {
|
|
10
|
+
facetAfter.items.push({ $skip: ((searcher.page - 1) * searcher.limit) || 0 })
|
|
11
|
+
facetAfter.items.push({ $limit: searcher.limit })
|
|
12
|
+
|
|
13
|
+
facetAfter.paging = [
|
|
14
|
+
{ $count: "total" },
|
|
15
|
+
{ $addFields: { page: searcher.page || 1, limit: searcher.limit } }
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return facetAfter
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default new GetStagePaginationFlowItem
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import CrudFlow from "./flow/CrudFlow"
|
|
|
3
3
|
import SearchFlow from "./flow/SearchFlow"
|
|
4
4
|
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem"
|
|
5
5
|
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem"
|
|
6
|
+
import { IFacet } from "./model/Facet"
|
|
6
7
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger"
|
|
7
8
|
import { Options } from "./types/Options"
|
|
8
9
|
import { Pagination, SearchResponse } from "./types/SearchResponse"
|
|
@@ -12,6 +13,6 @@ import { initialize } from "./utils/Utils"
|
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize,
|
|
15
|
-
BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem
|
|
16
|
+
BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet
|
|
16
17
|
}
|
|
17
18
|
|