Conversation
What was broken Clearing a billing account from an existing project did not persist. The Work UI sent an explicit null billingAccountId, but the Projects API treated that value as omitted, so the old billing account stayed on the project and appeared again after save. Root cause UpdateProjectDto inherited CreateProjectDto billingAccountId parsing, which normalizes null and empty string to undefined. The service clear path depended on a derived flag that is not materialized by class-transformer when only billingAccountId is sent. What was changed UpdateProjectDto now owns the update-time billingAccountId field, preserving null and empty string as explicit clear requests while still parsing numeric billing account ids. ProjectService now clears when the DTO billingAccountId is null, in addition to the existing internal clear flag. Any added/updated tests Added DTO coverage for null, empty string, and numeric billingAccountId updates. Updated the project service clear test to exercise billingAccountId: null directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
Clearing a billing account from an existing project did not persist. The Work UI sent an explicit null billingAccountId, but the Projects API treated that value as omitted, so the old billing account stayed on the project and appeared again after save.
Root cause
UpdateProjectDto inherited CreateProjectDto billingAccountId parsing, which normalizes null and empty string to undefined. The service clear path depended on a derived flag that is not materialized by class-transformer when only billingAccountId is sent.
What was changed
UpdateProjectDto now owns the update-time billingAccountId field, preserving null and empty string as explicit clear requests while still parsing numeric billing account ids. ProjectService now clears when the DTO billingAccountId is null, in addition to the existing internal clear flag.
Any added/updated tests
Added DTO coverage for null, empty string, and numeric billingAccountId updates. Updated the project service clear test to exercise billingAccountId: null directly.
Validation