axe-api 0.19.1 → 0.19.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release Notes
2
2
 
3
+ ## [0.19.2 (2022-01-22)](https://github.com/axe-api/axe-api/compare/0.19.2...0.19.1)
4
+
5
+ ### Fixed
6
+
7
+ - Fixed the calling `onBeforePaginate` and `onBeforeShow` hooks bug.
8
+
3
9
  ## [0.19.1 (2022-01-22)](https://github.com/axe-api/axe-api/compare/0.19.1...0.19.0)
4
10
 
5
11
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axe-api",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "AXE API is a simple tool which has been created based on Express and Knex.js to create Rest APIs quickly.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,15 +26,15 @@ export default async (context) => {
26
26
  // Binding parent id if there is.
27
27
  addForeignKeyQuery(request, query, relation, parentModel);
28
28
 
29
- // Users should be able to filter records
30
- queryParser.applyWheres(query, conditions.q);
31
-
32
29
  await callHooks(model, HOOK_FUNCTIONS.onBeforePaginate, {
33
30
  ...context,
34
31
  conditions,
35
32
  query,
36
33
  });
37
34
 
35
+ // Users should be able to filter records
36
+ queryParser.applyWheres(query, conditions.q);
37
+
38
38
  // User should be able to select sorting fields and types
39
39
  queryParser.applySorting(query, conditions.sort);
40
40
 
@@ -26,9 +26,6 @@ export default async (context) => {
26
26
  // If there is a relation, we should bind it
27
27
  addForeignKeyQuery(request, query, relation, parentModel);
28
28
 
29
- // Users should be able to filter records
30
- queryParser.applyWheres(query, conditions.q);
31
-
32
29
  // We should add this condition in here because of performance.
33
30
  query.where(
34
31
  model.instance.primaryKey,
@@ -41,6 +38,9 @@ export default async (context) => {
41
38
  conditions,
42
39
  });
43
40
 
41
+ // Users should be able to filter records
42
+ queryParser.applyWheres(query, conditions.q);
43
+
44
44
  let item = await query.first();
45
45
  if (!item) {
46
46
  throw new HttpResponse(404, {