Parse partOf relationships in API response
This adds new functionality to the CCE API that enables the parent/child relationship between CCE entriesadd-new-regnum-params
parent
10247a07ab
commit
a3c66b6aa5
|
@ -26,3 +26,6 @@ class QueryManager():
|
|||
|
||||
def orphanRenewalQuery(self, uuid):
|
||||
return self.session.query(Renewal).filter(Renewal.uuid == uuid).one()
|
||||
|
||||
def getParentCCE(self, parentID):
|
||||
return self.session.query(CCE).get(parentID)
|
|
@ -28,6 +28,8 @@ def fullTextQuery():
|
|||
for entry in matchingDocs:
|
||||
if entry.meta.index == 'cce':
|
||||
dbEntry = qManager.registrationQuery(entry.uuid)
|
||||
if dbEntry.parent_cce_id:
|
||||
dbEntry = qManager.getParentCCE(dbEntry.parent_cce_id)
|
||||
textResponse.addResult(MultiResponse.parseEntry(
|
||||
dbEntry,
|
||||
xml=sourceReturn
|
||||
|
@ -66,6 +68,8 @@ def regQuery(regnum):
|
|||
qManager = QueryManager(db.session)
|
||||
for entry in matchingDocs:
|
||||
dbEntry = qManager.registrationQuery(entry.uuid)
|
||||
if dbEntry.parent_cce_id:
|
||||
dbEntry = qManager.getParentCCE(dbEntry.parent_cce_id)
|
||||
regResponse.addResult(MultiResponse.parseEntry(
|
||||
dbEntry,
|
||||
xml=sourceReturn
|
||||
|
|
|
@ -39,7 +39,11 @@ class Response():
|
|||
'part': dbEntry.volume.part,
|
||||
'page': dbEntry.page,
|
||||
'page_position': dbEntry.page_position
|
||||
}
|
||||
},
|
||||
'has_parts': [
|
||||
Response.parseEntry(part)
|
||||
for part in dbEntry.children_cces
|
||||
]
|
||||
}
|
||||
response['renewals'] = [
|
||||
cls.parseRenewal(ren, source=xml)
|
||||
|
|
Loading…
Reference in New Issue