Skip to content

Commit

Permalink
[backend] Improve template loading if available in cache (#6516)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-julien committed Mar 30, 2024
1 parent 8fb5dbb commit 29d8f07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const workflowStatuses = (context: AuthContext) => {
const statuses = await listAllEntities<BasicWorkflowStatusEntity>(context, SYSTEM_USER, [ENTITY_TYPE_STATUS], args);
return statuses.map((status) => {
const template = templates.find((t) => t.internal_id === status.template_id);
return { ...status, name: template?.name ?? 'Error with template association' };
return { ...status, name: template?.name ?? 'Error with template association', template };
});
};
return { values: null, fn: reloadStatuses };
Expand Down
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/src/resolvers/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const statusResolvers: Resolvers = {
statuses: (_, args, context) => findAll(context, context.user, args),
},
Status: {
template: (current, _, context) => findTemplateById(context, context.user, current.template_id),
template: (current, _, context) => current.template ?? findTemplateById(context, context.user, current.template_id),
},
StatusTemplate: {
usages: (current, _, context) => statusTemplateUsagesNumber(context, context.user, current.id),
Expand Down

0 comments on commit 29d8f07

Please sign in to comment.