SoftwareBrothers / adminjs-sequelizejs

Sequelizejs adapter for AdminBro
MIT License
27 stars 34 forks source link

Filtering does not work for resources that include other models #37

Closed bakkerthehacker closed 4 years ago

bakkerthehacker commented 4 years ago

Using a resource in adminbro that includes another model, filtering on that resource no longer works in 0.5.0. The filter query gives the error SequelizeDatabaseError: column reference "name" is ambiguous.

wojtek-krysiak commented 4 years ago

can you paste a schema which causes an error?

bakkerthehacker commented 4 years ago
const TestModel = sequelize.define('TestModel', {
  name: {
    type: Sequelize.STRING,
    allowNull: false,
  },
}, {});

const OtherModel = sequelize.define('OtherModel', {
  name: {
    type: Sequelize.STRING,
    allowNull: false,
  },
}, {});

TestModel.hasMany(OtherModel);

TestModel.addScope('defaultScope', { include: [OtherModel] });

After adding a resource with resource: TestModel, and filtering TestModel on name, adminbro gives the error SequelizeDatabaseError: column reference "name" is ambiguous and only gives this error on admin-bro-sequelizejs versions >=0.5.0

wojtek-krysiak commented 4 years ago

ok - I know everything - added to backlog

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 1.0.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: