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

Ajusta a API para receber e armazenar collab #218

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions opac/webapp/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def __init__(self, doc_id, issue_id=None):
self.doc.htmls = None
self.doc.pdfs = None
self.doc.mat_suppl_items = None
self.doc.collabs = None

def add_identifiers(self, v2, aop_pid, other_pids=None):
# Identificadores
Expand Down Expand Up @@ -458,6 +459,14 @@ def publish_document(self, created, updated, is_public):
raise PublishDocumentError(e)
return self.doc

def add_collab(self, name):
# collabs = EmbeddedDocumentListField(Collab)
if self.doc.collabs is None:
self.doc.collabs = []
_collab = models.Collab()
_collab.name = name
self.doc.collabs.append(_collab)


def ArticleFactory(
document_id: str,
Expand Down Expand Up @@ -570,6 +579,11 @@ def ArticleFactory(
# add_doi_with_lang(self, language, doi)
# add_related_article(self, doi, ref_id, related_type)
factory.publish_document(data.get("created"), data.get("updated"), data.get("is_public"))

for item in data.get("collab") or []:
factory.add_collab(
name=item.get("name")
)

return article

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ zope.interface==5.5.2
tox==4.3.5
PyJWT==2.8.0
tenacity==8.2.3
-e git+https://[email protected]/scieloorg/opac_schema@v2.8.1#egg=Opac_Schema
-e git+https://[email protected]/scieloorg/opac_schema@v2.9.0#egg=Opac_Schema
-e git+https://[email protected]/scieloorg/[email protected]#egg=packtools
-e git+https://github.com/scieloorg/[email protected]#egg=scieloh5m5