Skip to content

Commit

Permalink
check if doi already associated when automatic mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzpeta committed Oct 7, 2024
1 parent 892b4ea commit 3de4e6b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions oarepo_doi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def create_doi(service, record, data, event=None):
"""if event = None, doi will be created as a draft."""

mapping = obj_or_import_string(service.mapping[record.schema])()
doi_value = mapping.get_doi(record)
if doi_value:
raise ValidationError(
message="DOI already associated with the record."
)
errors = mapping.metadata_check(record)
record_service = get_record_service_for_record(record)
record["links"] = record_service.links_item_tpl.expand(system_identity, record)
Expand Down

0 comments on commit 3de4e6b

Please sign in to comment.