New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pagination-plugin and fetch options on count fix #1914

Merged
merged 2 commits into from Dec 1, 2018

Conversation

Projects
2 participants
@throrin19
Copy link
Contributor

throrin19 commented Nov 13, 2018

Introduction

Make the pagination plugin fully compatible with others bookshelf plugins

Motivation

In my project, I use the plugin bookshelf-paranoia to use the soft delete feature. I have a problem with pagination.

If I want to show soft deleted items using pagination, the fetchPaginate function return correctly the models but don't return correct count.

After resarch, it appears the count part don't use passed fetch options except the transacting parameter.

Proposed solution

I propose to use others fetch options on count part omit all default fetch params (withRelated, ...) to avoid problems

@throrin19 throrin19 changed the title fix #1913 pagination-plugin and fetch options on count fix Nov 13, 2018

@ricardograca
Copy link
Member

ricardograca left a comment

This looks good, but it needs tests to verify the correct behavior of the fix and to ensure it doesn't get re-introduced in the future.

@throrin19

This comment has been minimized.

Copy link
Contributor

throrin19 commented Nov 13, 2018

I hope I make correct tests, I try if the count lost standard options and keep custom options

@ricardograca

This comment has been minimized.

Copy link
Member

ricardograca commented Nov 13, 2018

Nice work! I'll review this properly soon.

@ricardograca
Copy link
Member

ricardograca left a comment

Looks good to me and all tests pass.

@throrin19

This comment has been minimized.

Copy link
Contributor

throrin19 commented Nov 20, 2018

Great !! Have you a release date for this PR integration in bookshelf ? I realy need this in my current development

@ricardograca

This comment has been minimized.

Copy link
Member

ricardograca commented Nov 21, 2018

I will most likely make it to the next version (0.14.0) which will be released soon.

@ricardograca ricardograca added this to To Do in Version 0.14.0 via automation Nov 22, 2018

@ricardograca ricardograca moved this from To Do to In progress in Version 0.14.0 Nov 22, 2018

@ricardograca ricardograca merged commit bda57a3 into bookshelf:master Dec 1, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

Version 0.14.0 automation moved this from In progress to Done Dec 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment