Skip to content

Commit

Permalink
link data structure refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
saifulkhan committed Nov 26, 2021
1 parent 07d4373 commit aa30353
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions data-api/src/controllers/template.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,15 @@ export class TemplateController {

try {
const ontoPages: IOntoPage[] = await this.ontoPageService.getPagesBindingDataId(dataId);
const ontoPageIds: string[] = ontoPages.map((d: IOntoPage) => d._id.toString());
const links: { pageId: string; visFunction: string }[] = await Promise.all(
ontoPages.map(async (d: IOntoPage) => {
const pageId = d._id.toString();
const ontoPage = await this.ontoVisService.get(d.visId);
return { pageId: pageId, visFunction: ontoPage.function };
})
);

response.status(200).send(ontoPageIds);
response.status(200).send(links);
} catch (e: any) {
logger.error(`TemplateController:getPagesBindingDataId: error = ${JSON.stringify(e)}`);
next(new SomethingWentWrong(e.message));
Expand Down

0 comments on commit aa30353

Please sign in to comment.