Skip to content

Commit

Permalink
Merge pull request #218 from samuelveigarangel/issue-214
Browse files Browse the repository at this point in the history
Ajusta a API para receber e armazenar collab
  • Loading branch information
samuelveigarangel authored Nov 26, 2024
2 parents 6f46519 + 0d39a75 commit f1937f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit f1937f3

Please sign in to comment.