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: resolve not returning soft deleted relations with withDeleted find option #8017

Merged
merged 5 commits into from Aug 10, 2021

Conversation

nicosefer
Copy link
Contributor

@nicosefer nicosefer commented Aug 4, 2021

Description of change

This pull request includes a fix for find entities with soft deleted relations when using .find method passing withDeleted option.
Fix: Not returning soft deleted nested entities using withDeleted:true 7490

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #7490
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@pleerock
Copy link
Member

pleerock commented Aug 4, 2021

wow, teamwork 💯

@imnotjames
Copy link
Contributor

Is it possible to include the tests under test/functional/query-builder/soft-delete instead?

@nicosefer
Copy link
Contributor Author

Is it possible to include the tests under test/functional/query-builder/soft-delete instead?

Yes, of course. It's done ;)

Copy link
Contributor

@imnotjames imnotjames left a comment

Choose a reason for hiding this comment

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

This is a bit of a breaking behavior.

Given it's reversing another breaking behavior I'm fine with it.

It's all undefined and I don't particularly think either is correct at this point.

@imnotjames
Copy link
Contributor

Well that's odd. The build was fine in the PR but after merging it failed.

@imnotjames
Copy link
Contributor

Seems to not be operating well with embeds. Duplicates some data outside the embed. Going to do some research & do my best to not revert - but if I don't find the cause today I'll revert.

@nicosefer If you're able to as well that'd be great. Or any of the folks that approved this PR

@nicosefer
Copy link
Contributor Author

Seems to not be operating well with embeds. Duplicates some data outside the embed. Going to do some research & do my best to not revert - but if I don't find the cause today I'll revert.

@nicosefer If you're able to as well that'd be great. Or any of the folks that approved this PR

@imnotjames i'm sorry to hear that. Do you have any specific test case where we should look at?.
I just ran all the tests that includes "embedded" and the result was successful.

Screen Shot 2021-08-10 at 13 52 35

@imnotjames
Copy link
Contributor

imnotjames commented Aug 10, 2021

https://app.circleci.com/pipelines/github/typeorm/typeorm/3003/workflows/9bc5ea5a-5d8a-4f78-97ca-924862f0e12a/jobs/12906

  query builder > soft-delete
    1) should soft-delete and restore properties inside embeds as well

@nicosefer
Copy link
Contributor Author

@imnotjames I found something weird. The error was no caused by the change on the FindOptionsUtils implementation, but it's triggered on the tests by just only adding the @DeleteDateColumn() on the Photo entity /test/functional/query-builder/soft-delete/entity/Photo.ts

@nicosefer
Copy link
Contributor Author

@imnotjames I can update the test case and add a new one with another entities, but i guess a new bug was born 😆

@imnotjames
Copy link
Contributor

imnotjames commented Aug 10, 2021

If it wasn't caused by this change why did it show up when your PR was merged? If I revert the PR it seems to correct the failing test.

@nicosefer
Copy link
Contributor Author

If it wasn't caused by this change why did it show up when your PR was merged? If I revert the PR it seems to correct the failing test.

It was caused by adding the DeleteDateColumn on the Photo entity in the test case, not by the change in the implementation. You can revert the change and i can open a new PR with the exact same implementation code but just changing the test case and everything will run fine.

@nicosefer
Copy link
Contributor Author

@imnotjames I just uploaded a new PR with the changes that I mentioned recently in the tests
#8062

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants