Skip to content

Commit

Permalink
refactor: use updated model
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangoulding committed Jan 30, 2025
1 parent 3db9a94 commit 0414fa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ function go(licence) {
function _licenceContactDetails(licenceDocumentHeader) {
return [
...filteredContactDetailsByRole(licenceDocumentHeader.metadata.contacts),
..._licenceEntityRole(licenceDocumentHeader.licenceEntityRole)
..._licenceEntityRoles(licenceDocumentHeader.licenceEntityRoles)
]
}

function _licenceEntityRole(licenceEntityRole) {
return licenceEntityRole.map(_licenceEntity).sort(_sortLicenceEntity)
function _licenceEntityRoles(licenceEntityRoles) {
return licenceEntityRoles.map(_licenceEntity).sort(_sortLicenceEntity)
}

function _licenceEntity(entity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ async function _fetch(licenceId) {
.modifyGraph('licenceDocumentHeader', (builder) => {
builder.select(['id', 'metadata'])
})
.withGraphFetched('licenceDocumentHeader.licenceEntityRole')
.modifyGraph('licenceDocumentHeader.licenceEntityRole', (builder) => {
.withGraphFetched('licenceDocumentHeader.licenceEntityRoles')
.modifyGraph('licenceDocumentHeader.licenceEntityRoles', (builder) => {
builder.select(['role']).whereIn('role', ['primary_user', 'user_returns'])
})
.withGraphFetched('licenceDocumentHeader.licenceEntityRole.licenceEntity')
.modifyGraph('licenceDocumentHeader.licenceEntityRole.licenceEntity', (builder) => {
.withGraphFetched('licenceDocumentHeader.licenceEntityRoles.licenceEntity')
.modifyGraph('licenceDocumentHeader.licenceEntityRoles.licenceEntity', (builder) => {
builder.select(['name'])
})
}
Expand Down

0 comments on commit 0414fa1

Please sign in to comment.