Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backend] Improve template loading if available in cache (#6516) #6524

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading