From 1e158ba85523f0df085332d942d09ec886ab7fb1 Mon Sep 17 00:00:00 2001 From: Philipp Ossler Date: Thu, 25 Aug 2022 07:35:40 +0200 Subject: [PATCH] feat: expose error of process instance (#269) --- .../io/zeebe/zeeqs/data/repository/ErrorRepository.kt | 3 +++ .../graphql/resolvers/type/ProcessInstanceResolver.kt | 7 ++++++- .../src/main/resources/graphql/ProcessInstance.graphqls | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/data/src/main/kotlin/io/zeebe/zeeqs/data/repository/ErrorRepository.kt b/data/src/main/kotlin/io/zeebe/zeeqs/data/repository/ErrorRepository.kt index 225921ca..dd593d03 100644 --- a/data/src/main/kotlin/io/zeebe/zeeqs/data/repository/ErrorRepository.kt +++ b/data/src/main/kotlin/io/zeebe/zeeqs/data/repository/ErrorRepository.kt @@ -6,4 +6,7 @@ import org.springframework.stereotype.Repository @Repository interface ErrorRepository: PagingAndSortingRepository { + + fun findByProcessInstanceKey(processInstanceKey: Long): Error? + } \ No newline at end of file diff --git a/graphql-api/src/main/kotlin/io/zeebe/zeeqs/graphql/resolvers/type/ProcessInstanceResolver.kt b/graphql-api/src/main/kotlin/io/zeebe/zeeqs/graphql/resolvers/type/ProcessInstanceResolver.kt index 915127b2..0f67f20f 100644 --- a/graphql-api/src/main/kotlin/io/zeebe/zeeqs/graphql/resolvers/type/ProcessInstanceResolver.kt +++ b/graphql-api/src/main/kotlin/io/zeebe/zeeqs/graphql/resolvers/type/ProcessInstanceResolver.kt @@ -16,7 +16,8 @@ class ProcessInstanceResolver( val incidentRepository: IncidentRepository, val elementInstanceRepository: ElementInstanceRepository, val timerRepository: TimerRepository, - val messageSubscriptionRepository: MessageSubscriptionRepository + val messageSubscriptionRepository: MessageSubscriptionRepository, + val errorRepository: ErrorRepository ) : GraphQLResolver { fun startTime(processInstance: ProcessInstance, zoneId: String): String? { @@ -77,4 +78,8 @@ class ProcessInstanceResolver( return messageSubscriptionRepository.findByProcessInstanceKey(processInstance.key) } + fun error(processInstance: ProcessInstance): Error? { + return errorRepository.findByProcessInstanceKey(processInstance.key) + } + } \ No newline at end of file diff --git a/graphql-api/src/main/resources/graphql/ProcessInstance.graphqls b/graphql-api/src/main/resources/graphql/ProcessInstance.graphqls index ca3ca3b1..4ca6890e 100644 --- a/graphql-api/src/main/resources/graphql/ProcessInstance.graphqls +++ b/graphql-api/src/main/resources/graphql/ProcessInstance.graphqls @@ -34,6 +34,8 @@ type ProcessInstance { timers: [Timer!] # the opened message subscriptions related to the process instance (e.g. message catch events) messageSubscriptions: [MessageSubscription!] + # the occurred error related to the process instance + error: Error } enum ProcessInstanceState {