Skip to content

Commit

Permalink
Refactoring frontend middleware to pick off id field from entity route
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner committed Nov 23, 2020
1 parent 609a849 commit 463dccd
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@ export function noAncestorsTwoChildren(): { dataAccessLayer: DataAccessLayer; me
* Get entities matching a document.
*/
entities(): Promise<ResolverEntityIndex> {
return Promise.resolve([{ entity_id: metadata.entityIDs.origin }]);
return Promise.resolve([
{
name: 'endpoint',
schema: {
id: 'process.entity_id',
parent: 'process.parent.entity_id',
ancestry: 'process.Ext.ancestry',
},
id: metadata.entityIDs.origin,
},
]);
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,17 @@ export function noAncestorsTwoChildenInIndexCalledAwesomeIndex(): {
entities({ indices }): Promise<ResolverEntityIndex> {
// Only return values if the `indices` array contains exactly `'awesome_index'`
if (indices.length === 1 && indices[0] === 'awesome_index') {
return Promise.resolve([{ entity_id: metadata.entityIDs.origin }]);
return Promise.resolve([
{
name: 'endpoint',
schema: {
id: 'process.entity_id',
parent: 'process.parent.entity_id',
ancestry: 'process.Ext.ancestry',
},
id: metadata.entityIDs.origin,
},
]);
}
return Promise.resolve([]);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,17 @@ export function noAncestorsTwoChildrenWithRelatedEventsOnOriginWithOneAfterCurso
* Get entities matching a document.
*/
async entities(): Promise<ResolverEntityIndex> {
return [{ entity_id: metadata.entityIDs.origin }];
return [
{
name: 'endpoint',
schema: {
id: 'process.entity_id',
parent: 'process.parent.entity_id',
ancestry: 'process.Ext.ancestry',
},
id: metadata.entityIDs.origin,
},
];
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,17 @@ export function noAncestorsTwoChildrenWithRelatedEventsOnOrigin(): {
* Get entities matching a document.
*/
async entities(): Promise<ResolverEntityIndex> {
return [{ entity_id: metadata.entityIDs.origin }];
return [
{
name: 'endpoint',
schema: {
id: 'process.entity_id',
parent: 'process.parent.entity_id',
ancestry: 'process.Ext.ancestry',
},
id: metadata.entityIDs.origin,
},
];
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,17 @@ export function oneNodeWithPaginatedEvents(): {
* Get entities matching a document.
*/
async entities(): Promise<ResolverEntityIndex> {
return [{ entity_id: metadata.entityIDs.origin }];
return [
{
name: 'endpoint',
schema: {
id: 'process.entity_id',
parent: 'process.parent.entity_id',
ancestry: 'process.Ext.ancestry',
},
id: metadata.entityIDs.origin,
},
];
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function ResolverTreeFetcher(
});
return;
}
const entityIDToFetch = matchingEntities[0].entity_id;
const entityIDToFetch = matchingEntities[0].id;
result = await dataAccessLayer.resolverTree(
entityIDToFetch,
lastRequestAbortController.signal
Expand Down

0 comments on commit 463dccd

Please sign in to comment.