Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

Fix Account Holding validation and synchronization#1818

Merged
Shpigford merged 3 commits intomainfrom
holding-model-constraints
Feb 7, 2025
Merged

Fix Account Holding validation and synchronization#1818
Shpigford merged 3 commits intomainfrom
holding-model-constraints

Conversation

@Shpigford
Copy link
Member

Fixes #1781

  • Add comprehensive validations for Account::Holding
  • Implement validation to ensure amount matches qty * price
  • Update Account::Syncer to include qty and price during synchronization
  • Add database constraints for holding attributes and calculations

Fixes #1781

- Add comprehensive validations for Account::Holding
- Implement validation to ensure amount matches qty * price
- Update Account::Syncer to include qty and price during synchronization
- Add database constraints for holding attributes and calculations
@Shpigford
Copy link
Member Author

@zachgoll Is this what you had in mind for addressing #1781 and #1767?

@Shpigford Shpigford requested a review from zachgoll February 6, 2025 20:49
Copy link
Contributor

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

Yep, that's pretty much what I was thinking!

Align with project convention of keeping complex validations in ActiveRecord
- Remove database-level check constraints for quantity, price, and amount
- Maintain database-level null and unique constraints
- Prepare for more flexible validation in the model layer
@Shpigford Shpigford merged commit cf23673 into main Feb 7, 2025
5 checks passed
@Shpigford Shpigford deleted the holding-model-constraints branch February 7, 2025 16:42
pranav7 pushed a commit to pranav7/maybe that referenced this pull request Mar 2, 2025
* Fix Account Holding validation and synchronization

Fixes #1781

- Add comprehensive validations for Account::Holding
- Implement validation to ensure amount matches qty * price
- Update Account::Syncer to include qty and price during synchronization
- Add database constraints for holding attributes and calculations

* Remove database check constraints for Account Holdings

Align with project convention of keeping complex validations in ActiveRecord
- Remove database-level check constraints for quantity, price, and amount
- Maintain database-level null and unique constraints
- Prepare for more flexible validation in the model layer
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Holding model should have ActiveRecord and DB null constraints

2 participants