axe-api 1.0.0-rc8 → 1.0.0-rc9
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.
|
@@ -9,8 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const Helpers_1 = require("../../Handlers/Helpers");
|
|
12
13
|
exports.default = (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
14
|
var _a, _b;
|
|
15
|
+
if (context.query && context.queryParser && context.conditions) {
|
|
16
|
+
// Users should be able to select some fields to show.
|
|
17
|
+
context.queryParser.applyFields(context.query, context.conditions.fields);
|
|
18
|
+
// Binding parent id if there is.
|
|
19
|
+
(0, Helpers_1.addForeignKeyQuery)(context.req, context.query, context.relation, context.parentModel);
|
|
20
|
+
// Users should be able to filter records
|
|
21
|
+
context.queryParser.applyWheres(context.query, context.conditions.q);
|
|
22
|
+
// User should be able to select sorting fields and types
|
|
23
|
+
context.queryParser.applySorting(context.query, context.conditions.sort);
|
|
24
|
+
}
|
|
14
25
|
context.result = yield context.query.paginate({
|
|
15
26
|
perPage: ((_a = context.conditions) === null || _a === void 0 ? void 0 : _a.per_page) || 10,
|
|
16
27
|
currentPage: ((_b = context.conditions) === null || _b === void 0 ? void 0 : _b.page) || 1,
|
|
@@ -19,12 +19,4 @@ exports.default = (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19
19
|
context.query = context.database.from(context.model.instance.table);
|
|
20
20
|
// If there is a deletedAtColumn, it means that this table support soft-delete
|
|
21
21
|
(0, Helpers_1.addSoftDeleteQuery)(context.model, context.conditions, context.query);
|
|
22
|
-
// Users should be able to select some fields to show.
|
|
23
|
-
context.queryParser.applyFields(context.query, context.conditions.fields);
|
|
24
|
-
// Binding parent id if there is.
|
|
25
|
-
(0, Helpers_1.addForeignKeyQuery)(context.req, context.query, context.relation, context.parentModel);
|
|
26
|
-
// Users should be able to filter records
|
|
27
|
-
context.queryParser.applyWheres(context.query, context.conditions.q);
|
|
28
|
-
// User should be able to select sorting fields and types
|
|
29
|
-
context.queryParser.applySorting(context.query, context.conditions.sort);
|
|
30
22
|
});
|