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

sequelize findAndCountAll() issue with include #209

Open
hehaka opened this issue Apr 21, 2017 · 2 comments
Open

sequelize findAndCountAll() issue with include #209

hehaka opened this issue Apr 21, 2017 · 2 comments

Comments

@hehaka
Copy link

hehaka commented Apr 21, 2017

Hi,
For the models which use associations through include there is an wrong count in the Content-Range header of the epilogue library.

According to
sequelize/sequelize#7225
You need to use distinct = true in the findAndCountAll options.

I have made a local workaround in the Controllers/list.js List.prototype.fetch = function(req, res, context) function by putting
options.distinct = true;

You should populate it to the resource function options of the library.

@hiradimir
Copy link

I have same issue.


does epilogue is not maintained?

@hiradimir
Copy link

I found workaround with milestone.

<targetResource>.use({
      list: {
        fetch: {
          before: function (req, res, context) {
            context.options.col = '<col> ex: "TableName"."primaryKey" ';
            context.options.distinct = true;
            return context.continue;
          }
        }
      }
    })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants