不要怂,就是干,撸起袖子干!

Commit b42bbc7a by Igor Szymanski Committed by Sushant

feat(types): enabled string association (#10481)

1 parent 1d3714a2
...@@ -913,6 +913,22 @@ describe(Support.getTestDialectTeaser('Include'), () => { ...@@ -913,6 +913,22 @@ describe(Support.getTestDialectTeaser('Include'), () => {
}); });
}); });
it('should support eager loading associations using the name of the relation (string)', function() {
return this.Team.findOne({
where: {
name: 'TeamA'
},
include: [
{
association: 'members',
required: true
}
]
}).then(team => {
expect(team.members).to.have.length(2);
});
});
it('should not ripple grandchild required to top level find when required of child is not given (implicitly false)', function() { it('should not ripple grandchild required to top level find when required of child is not given (implicitly false)', function() {
return this.Team.findAll({ return this.Team.findAll({
include: [ include: [
......
...@@ -319,7 +319,7 @@ export interface IncludeOptions extends Filterable, Projectable { ...@@ -319,7 +319,7 @@ export interface IncludeOptions extends Filterable, Projectable {
/** /**
* The association you want to eagerly load. (This can be used instead of providing a model/as pair) * The association you want to eagerly load. (This can be used instead of providing a model/as pair)
*/ */
association?: Association; association?: Association | string;
/** /**
* Custom `on` clause, overrides default. * Custom `on` clause, overrides default.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!