@azteam/express 1.2.227 → 1.2.230
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/package.json
CHANGED
package/src/AdminController.js
CHANGED
|
@@ -41,17 +41,21 @@ export default function (options = {}) {
|
|
|
41
41
|
req.paginate.page = req.query.page ? Number(req.query.page) : 1;
|
|
42
42
|
req.paginate.offset = (req.paginate.page - 1) * req.paginate.limit;
|
|
43
43
|
|
|
44
|
-
delete req.query.page;
|
|
45
|
-
|
|
46
44
|
if (req.query.sort_by && options.sortFields.includes(req.query.sort_by)) {
|
|
47
45
|
req.paginate.sort = {
|
|
48
46
|
[req.query.sort_by]: req.query.sort_type === 'asc' ? 'asc' : 'desc',
|
|
49
47
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
} else if (options.sortFields.length > 0) {
|
|
49
|
+
const sortBy = options.sortFields[0];
|
|
50
|
+
req.paginate.sort = {
|
|
51
|
+
[sortBy]: 'asc',
|
|
52
|
+
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
delete req.query.sort_by;
|
|
56
|
+
delete req.query.sort_type;
|
|
57
|
+
delete req.query.page;
|
|
58
|
+
|
|
55
59
|
for (const key in req.query) {
|
|
56
60
|
if (req.query.hasOwnProperty(key)) {
|
|
57
61
|
const value = req.query[key];
|
package/src/validate.js
CHANGED
|
@@ -94,6 +94,10 @@ export const schemaVersion = (optional = false) => ({
|
|
|
94
94
|
max: 300,
|
|
95
95
|
optional,
|
|
96
96
|
});
|
|
97
|
+
export const schemaArray = (optional = false) => ({
|
|
98
|
+
type: 'array',
|
|
99
|
+
optional,
|
|
100
|
+
});
|
|
97
101
|
export const schemaJSON = (optional = false) => ({
|
|
98
102
|
type: 'json',
|
|
99
103
|
optional,
|