Skip to content

Set Id property of Device to force a save instead of a create#2420

Merged
trmartin4 merged 1 commit intomasterfrom
bug/SG-823-add-device-id
Nov 18, 2022
Merged

Set Id property of Device to force a save instead of a create#2420
trmartin4 merged 1 commit intomasterfrom
bug/SG-823-add-device-id

Conversation

@trmartin4
Copy link
Member

Type of change

- [X] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

In this PR, I added logic to save a known device regardless of whether it existed or not, in order to always update the push token (if there was one on the request). In doing so, I introduced a bug in which it attempted to always do a "Create" on the Device table for existing devices. The SaveAsync() method determines whether to create or update based on the presence of the Id property. I missed setting the Id of the device to the one previously retrieved.

Code changes

  • BaseRequestValidator.cs: Set the Id property on the request.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • If making database changes - make sure you also update Entity Framework queries and/or migrations
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@trmartin4 trmartin4 requested a review from a team November 18, 2022 15:16
Copy link
Member

@differsthecat differsthecat left a comment

Choose a reason for hiding this comment

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

Makes sense and looks good 👍

@trmartin4 trmartin4 merged commit 02e4b10 into master Nov 18, 2022
@trmartin4 trmartin4 deleted the bug/SG-823-add-device-id branch November 18, 2022 15:22
trmartin4 added a commit that referenced this pull request Nov 21, 2022
… a new one instead of updating existing. (#2420)"

This reverts commit 02e4b10.
trmartin4 added a commit that referenced this pull request Dec 12, 2022
* Revert "Set Id property on existing devices so we don't try to create a new one instead of updating existing. (#2420)"

This reverts commit 02e4b10.

* Revert "Update push token on login to allow multiple users on mobile devices (#2404)"

This reverts commit 24469e2.

* Added back test changes.
eliykat pushed a commit that referenced this pull request Jan 10, 2023
* Revert "Set Id property on existing devices so we don't try to create a new one instead of updating existing. (#2420)"

This reverts commit 02e4b10.

* Revert "Update push token on login to allow multiple users on mobile devices (#2404)"

This reverts commit 24469e2.

* Added back test changes.
eliykat pushed a commit that referenced this pull request Jan 10, 2023
* Revert "Set Id property on existing devices so we don't try to create a new one instead of updating existing. (#2420)"

This reverts commit 02e4b10.

* Revert "Update push token on login to allow multiple users on mobile devices (#2404)"

This reverts commit 24469e2.

* Added back test changes.
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.

2 participants