Skip to content

Commit

Permalink
save doi to db
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzpeta committed Oct 2, 2024
1 parent 7c76883 commit 1f8730c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion oarepo_doi/api.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import json
import uuid

import requests

from invenio_access.permissions import system_identity
from invenio_base.utils import obj_or_import_string
from invenio_communities import current_communities
from invenio_db import db
from invenio_pidstore.providers.base import BaseProvider
from invenio_search.engine import dsl
from marshmallow.exceptions import ValidationError
from oarepo_runtime.datastreams.utils import get_record_service_for_record
Expand Down Expand Up @@ -51,6 +53,12 @@ def create_doi(service, record, data, event=None):
doi_value = json_content["data"]["id"]
mapping.add_doi(record, data, doi_value)

if event:
pid_status = 'R' #registred
else: pid_status = 'K' #reserved
BaseProvider.create('doi', doi_value, 'rec', record.id, pid_status)
db.session.commit()


def edit_doi(service, record, event=None):
"""edit existing draft"""
Expand Down

0 comments on commit 1f8730c

Please sign in to comment.