Skip to content
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

throrin19
Copy link
Contributor

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
Copy link
Member

@ricardograca ricardograca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

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

@ricardograca
Copy link
Member

Nice work! I'll review this properly soon.

Copy link
Member

@ricardograca ricardograca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and all tests pass.

@throrin19
Copy link
Contributor Author

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

@ricardograca
Copy link
Member

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
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
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants