sequelize-transparent-cache icon indicating copy to clipboard operation
sequelize-transparent-cache copied to clipboard

Enhanced support of association loading and added multilevel association

Open ignacioblit opened this issue 6 years ago • 3 comments

As discussed on this issue (https://github.com/DanielHreben/sequelize-transparent-cache/issues/34) I added a more safe loadAssociations function to the project which should not error if the name is not defined or found.

ignacioblit avatar Jun 18 '19 20:06 ignacioblit

@ignacioblit seems like the problem is fixed, can you please confirm and close this PR if so?

DanielHreben avatar Jul 02 '19 14:07 DanielHreben

@DanielHreben https://github.com/DanielHreben/sequelize-transparent-cache/pull/41/ would still throw if the model name is not as expected, just as described on https://github.com/DanielHreben/sequelize-transparent-cache/issues/34 .

It also does not cover the case of loading associations within associations, which I think is a valid important use case.

Both of these use cases are covered in this PR. The _injectScope({}) is optional, if that is what scares you, though I think having the configured scope is also nice to have.

I would really like to see this functionality in the library, if you are willing, please work with me to get this to a state where you are comfortable merging.

ignacioblit avatar Jul 02 '19 15:07 ignacioblit

@ignacioblit got it. I don't mind to have this code in the library, my main concern is missing tests. So if you can add tests covering all cases this code supposed to fix - we can merge it.

DanielHreben avatar Jul 03 '19 02:07 DanielHreben