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

Validate constituents before creating virtual object #366

Merged
merged 1 commit into from
Sep 5, 2019

Conversation

mjgiarlo
Copy link
Member

@mjgiarlo mjgiarlo commented Sep 5, 2019

Fixes #365

Includes:

  • Add ItemQueryService.validate_combinable_items. This new class method takes an array of druids and makes sure each is combinable. If any are not, a hash of errors is created and returned.
  • Validate all items to be combined before modifying any of them.
  • Raise exception from objects controller when constituent service raises.

@coveralls
Copy link

coveralls commented Sep 5, 2019

Coverage Status

Coverage increased (+0.02%) to 97.34% when pulling d2bcc7b on validate_constituents_365 into eee6c5b on master.

@@ -11,6 +11,20 @@ def initialize(id:, item_relation: default_item_relation)

delegate :allows_modification?, to: :item

# @param [Array] druids a list of druids
# @raises [RuntimeError] if any items are dark, citation_only, or not modifiable
Copy link
Contributor

Choose a reason for hiding this comment

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

I don’t think this raises

Copy link
Member Author

@mjgiarlo mjgiarlo Sep 5, 2019

Choose a reason for hiding this comment

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

It does not. Good 👁️. This was from a prior implementation I worked on. Removing.

Fixes #365

Includes:
* Add `ItemQueryService.validate_combinable_items`. This new class method takes an array of druids and makes sure each is combinable. If any are not, a hash of errors is created and returned.
* Validate all items to be combined before modifying any of them
* Return HTTP 422 when constituent service returns errors
@mjgiarlo
Copy link
Member Author

mjgiarlo commented Sep 5, 2019

@jcoyne this is ready for another look now. Thanks for the review!

@jcoyne jcoyne merged commit 1c13075 into master Sep 5, 2019
@jcoyne jcoyne deleted the validate_constituents_365 branch September 5, 2019 18:36
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.

Validate all children before adding as constituents
3 participants