[Sequelize]: scope should be supported for all association types (#35420)

* [Sequelize]: Adding support for association scopes on all associations

* [Sequelize]: Adding support for association scopes on all associations
This commit is contained in:
Dan Rumney 2019-05-14 16:36:16 -05:00 committed by Nathan Shively-Sanders
parent 81fc741f8d
commit 8dfd127a63
2 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,7 @@
// Dima Smirnov <https://github.com/smff>
// Duy Truong <https://github.com/truongkhanhduy95>
// Emmanuel Gautier <https://github.com/emmanuelgautier>
// Dan Rumney <https://github.com/dancrumb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -1273,6 +1274,7 @@ declare namespace sequelize {
constraints?: boolean;
foreignKeyConstraint?: boolean;
scope?: AssociationScope;
}
/**

View File

@ -136,6 +136,7 @@ User.hasMany( User, {
foreignKey : 'parent',
foreignKeyConstraint : true
} );
User.hasOne( Task, { foreignKey : 'userId', as : 'activeTasks', scope : { active : true } } );
User.belongsToMany( Task, { through : 'UserTasks' } );
User.belongsToMany( User, { through : Task } );