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

fix: remove queryInterface reference #948

Merged
merged 1 commit into from
Jul 12, 2024
Merged

fix: remove queryInterface reference #948

merged 1 commit into from
Jul 12, 2024

Conversation

carlosvdr
Copy link
Contributor

@carlosvdr carlosvdr commented Jul 10, 2024

Regarding issue #946
Instead of passing along a reference better to just use the sequelize reference inside the model object

@carlosvdr carlosvdr self-assigned this Jul 10, 2024
@carlosvdr carlosvdr changed the title fix: mark queryInterface as a non optional value fix: remove queryInterface refference Jul 10, 2024
@carlosvdr carlosvdr changed the title fix: remove queryInterface refference fix: remove queryInterface reference Jul 10, 2024
@carlosvdr carlosvdr requested a review from aasseman July 10, 2024 20:58
@carlosvdr carlosvdr linked an issue Jul 10, 2024 that may be closed by this pull request
@aasseman aasseman added the TAP label Jul 10, 2024
Copy link
Contributor

@fordN fordN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM 👍

@fordN
Copy link
Contributor

fordN commented Jul 12, 2024

Not clear if it resolves the referenced issue though. Were you able to reproduce that?

@carlosvdr
Copy link
Contributor Author

Wasn't able to reproduce it, we did some digging about it and it seems it was some PG connection related issue which is out of our hands.
Vincent who found this, just restarted and the problem was solved.
But while doing that I realized there is a better way of doing the raw queries.
What im proposing is instead of creating queryInterface from the sequelize object
To create it from the model
Before i would create a reference of sequelize's query called queryInterface which allows me to handle raw queries
I would pass along this object all the way to the AllocationReceiptCollector
So the change would be instead of passing queryInterface , i would directly query through sequelize reference which is contained inside the model thus getting through the process of passing along queryInterace to just raw query like this
this.models.receiptAggregateVouchers.sequelize?.query(query)
which would simplify the code
I believe doing this diminishes the possibility of that problem since we are not passing along any more extra references but using what we already had from before (coming from the model), which we know is pretty stable

@carlosvdr carlosvdr marked this pull request as ready for review July 12, 2024 19:12
Currently queryInterface is passed as an arg
So now we use the refference of sequelize obtained from the model
@carlosvdr carlosvdr merged commit d86d146 into main Jul 12, 2024
10 checks passed
@carlosvdr carlosvdr deleted the issue946 branch July 12, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out Issue regarding sequelize
3 participants