From 3da6ef75284ef5e3213de47eb62ef87779b09593 Mon Sep 17 00:00:00 2001 From: Adrien Servel Date: Wed, 29 Jan 2025 13:43:07 +0100 Subject: [PATCH] [backend] Fix null for objectParticipant in Task --- .../opencti-graphql/src/modules/task/task-resolvers.ts | 5 +++++ .../opencti-graphql/src/modules/task/task.graphql | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/opencti-platform/opencti-graphql/src/modules/task/task-resolvers.ts b/opencti-platform/opencti-graphql/src/modules/task/task-resolvers.ts index 0969ad893dd6..30b45af303b6 100644 --- a/opencti-platform/opencti-graphql/src/modules/task/task-resolvers.ts +++ b/opencti-platform/opencti-graphql/src/modules/task/task-resolvers.ts @@ -1,5 +1,7 @@ import type { Resolvers } from '../../generated/graphql'; import { findAll, findById, taskAdd, taskAddRelation, taskContainsStixObjectOrStixRelationship, taskDelete, taskDeleteRelation, taskEdit } from './task-domain'; +import { loadThroughDenormalized } from '../../resolvers/stix'; +import { INPUT_PARTICIPANT } from '../../schema/general'; const taskResolvers: Resolvers = { Query: { @@ -9,6 +11,9 @@ const taskResolvers: Resolvers = { return taskContainsStixObjectOrStixRelationship(context, context.user, args.id, args.stixObjectOrStixRelationshipId); }, }, + Task: { + objectParticipant: (container, _, context) => loadThroughDenormalized(context, context.user, container, INPUT_PARTICIPANT, { sortBy: 'user_email' }), + }, Mutation: { taskAdd: (_, { input }, context) => taskAdd(context, context.user, input), taskDelete: (_, { id }, context) => taskDelete(context, context.user, id), diff --git a/opencti-platform/opencti-graphql/src/modules/task/task.graphql b/opencti-platform/opencti-graphql/src/modules/task/task.graphql index 036c818f4467..077865d77580 100644 --- a/opencti-platform/opencti-graphql/src/modules/task/task.graphql +++ b/opencti-platform/opencti-graphql/src/modules/task/task.graphql @@ -93,7 +93,7 @@ type Task implements Container & StixDomainObject & StixCoreObject & StixObject modified: DateTime x_opencti_graph_data: String objectAssignee: [Assignee!] - objectParticipant: [Participant!] + objectParticipant: [Participant!]! avatar: OpenCtiFile # Container authorized_members: [MemberAccess!]