Skip to content

Commit

Permalink
馃悰 Fixed all known filter limitations (#10159)
Browse files Browse the repository at this point in the history
refs #10105, closes #10108, closes TryGhost/Ghost#9950, refs TryGhost/Ghost#9923, refs TryGhost/Ghost#9916, refs TryGhost/Ghost#9574, refs TryGhost/Ghost#6345, refs TryGhost/Ghost#6309, refs TryGhost/Ghost#6158, refs TryGhost/GQL#16

- removed GQL dependency
- replaced GQL with our brand new NQL implementation
- fixed all known filter limitations
- GQL suffered from some underlying filter bugs, which NQL tried to fix
- the bugs were mostly in how we query the database for relation filtering
- the underlying problem was caused by a too simple implementation of querying the relations
- mongo-knex has implemented a more robust and complex filtering mechanism for relations
- replaced logic in our bookshelf filter plugin
- we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex.

NQL: https://github.com/NexesJS/NQL
mongo-knex: https://github.com/NexesJS/mongo-knex
  • Loading branch information
kirrg001 authored and daniellockyer committed Jun 15, 2021
1 parent fca13a4 commit 737db4b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/bookshelf-pagination/lib/bookshelf-pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ pagination = function pagination(bookshelf) {

throw err;
});
}).catch((err) => {
// CASE: SQL syntax is incorrect
if (err.errno === 1054 || err.errno === 1) {
throw new common.errors.BadRequestError({
message: common.i18n.t('errors.models.general.sql'),
err: err
});
}

throw err;
});
}
});
Expand Down

0 comments on commit 737db4b

Please sign in to comment.