-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #345 from camunda-community-hub/query-devision-eva…
…luations feat: Query for decision evaluations
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...src/main/kotlin/io/zeebe/zeeqs/graphql/resolvers/query/DecisionEvaluationQueryResolver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.zeebe.zeeqs.graphql.resolvers.query | ||
|
||
import io.zeebe.zeeqs.data.entity.DecisionEvaluation | ||
import io.zeebe.zeeqs.data.entity.DecisionEvaluationState | ||
import io.zeebe.zeeqs.data.repository.DecisionEvaluationRepository | ||
import io.zeebe.zeeqs.graphql.resolvers.connection.DecisionEvaluationConnection | ||
import org.springframework.data.domain.PageRequest | ||
import org.springframework.data.repository.findByIdOrNull | ||
import org.springframework.graphql.data.method.annotation.Argument | ||
import org.springframework.graphql.data.method.annotation.QueryMapping | ||
import org.springframework.stereotype.Controller | ||
|
||
@Controller | ||
class DecisionEvaluationQueryResolver( | ||
private val decisionEvaluationRepository: DecisionEvaluationRepository | ||
) { | ||
|
||
@QueryMapping | ||
fun decisionEvaluations( | ||
@Argument perPage: Int, | ||
@Argument page: Int, | ||
@Argument stateIn: List<DecisionEvaluationState> | ||
): DecisionEvaluationConnection { | ||
return DecisionEvaluationConnection( | ||
getItems = { | ||
decisionEvaluationRepository.findByStateIn( | ||
stateIn, | ||
PageRequest.of(page, perPage) | ||
) | ||
}, | ||
getCount = { decisionEvaluationRepository.countByStateIn(stateIn) } | ||
) | ||
} | ||
|
||
@QueryMapping | ||
fun decisionEvaluation(@Argument key: Long): DecisionEvaluation? { | ||
return decisionEvaluationRepository.findByIdOrNull(key) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters