From e570fa0da5d5c0a1f3bc245fe714ab410004b02f Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Wed, 8 Jan 2025 15:12:37 -0600 Subject: [PATCH] cleanup --- .../lucuma/odb/graphql/OdbSchema.graphql | 35 --------------- .../service/src/main/resources/logback.xml | 2 +- .../odb/graphql/input/WhereObservation.scala | 7 +-- .../input/WhereObservationWorkflow.scala | 43 ------------------- .../odb/graphql/input/WhereProposal.scala | 15 ++++--- 5 files changed, 13 insertions(+), 89 deletions(-) delete mode 100644 modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservationWorkflow.scala diff --git a/modules/schema/src/main/resources/lucuma/odb/graphql/OdbSchema.graphql b/modules/schema/src/main/resources/lucuma/odb/graphql/OdbSchema.graphql index e9a7f93d2..223de8d22 100644 --- a/modules/schema/src/main/resources/lucuma/odb/graphql/OdbSchema.graphql +++ b/modules/schema/src/main/resources/lucuma/odb/graphql/OdbSchema.graphql @@ -12654,18 +12654,8 @@ input WhereObservation { """ scienceBand: WhereOptionOrderScienceBand - workflow: WhereObservationWorkflow - -} - -input WhereObservationWorkflow { - AND: [WhereObservationWorkflow!] - OR: [WhereObservationWorkflow!] - NOT: WhereObservationWorkflow - state: WhereEqObservationWorkflowState } - """ Configuration request filter options. All specified items must match. """ @@ -13630,31 +13620,6 @@ input WhereOrderConfigurationRequestStatus { LTE: ConfigurationRequestStatus } -input WhereEqObservationWorkflowState { - - """ - Matches if the property is exactly the supplied value. - """ - EQ: ObservationWorkflowState - - """ - Matches if the property is not the supplied value. - """ - NEQ: ObservationWorkflowState - - """ - Matches if the property value is any of the supplied options. - """ - IN: [ObservationWorkflowState!] - - """ - Matches if the property value is none of the supplied values. - """ - NIN: [ObservationWorkflowState!] - -} - - """ Filters on equality or order comparisons of PosBigDecimal properties. All supplied criteria must match, but usually only one is selected. diff --git a/modules/service/src/main/resources/logback.xml b/modules/service/src/main/resources/logback.xml index 49e8c9de9..14abfe2c1 100644 --- a/modules/service/src/main/resources/logback.xml +++ b/modules/service/src/main/resources/logback.xml @@ -12,7 +12,7 @@ - + diff --git a/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservation.scala b/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservation.scala index 8aa4a8cd1..9ac6efdc8 100644 --- a/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservation.scala +++ b/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservation.scala @@ -21,7 +21,6 @@ object WhereObservation { val WhereReferenceBinding = WhereObservationReference.binding(path / "reference") val WhereProgramBinding = WhereProgram.binding(path / "program") val ScienceBandBinding = WhereOptionOrder.binding(path / "scienceBand", enumeratedBinding[ScienceBand]) - val WorkflowBinding = WhereObservationWorkflow.binding(path / "workflow") lazy val WhereObservationBinding = binding(path) ObjectFieldsBinding.rmap { @@ -34,10 +33,9 @@ object WhereObservation { WhereProgramBinding.Option("program", rProgram), SubtitleBinding.Option("subtitle", rSubtitle), ScienceBandBinding.Option("scienceBand", rScienceBand), - WorkflowBinding.Option("workflow", rWorkflow) ) => - (rAND, rOR, rNOT, rId, rRef, rProgram, rSubtitle, rScienceBand, rWorkflow).parMapN { - (AND, OR, NOT, id, ref, program, subtitle, scienceBand, workflow) => + (rAND, rOR, rNOT, rId, rRef, rProgram, rSubtitle, rScienceBand).parMapN { + (AND, OR, NOT, id, ref, program, subtitle, scienceBand) => and(List( AND.map(and), OR.map(or), @@ -47,7 +45,6 @@ object WhereObservation { program, subtitle, scienceBand, - workflow, ).flatten) } } diff --git a/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservationWorkflow.scala b/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservationWorkflow.scala deleted file mode 100644 index 67e0ee921..000000000 --- a/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereObservationWorkflow.scala +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA) -// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause - -package lucuma.odb.graphql - -package input - -import cats.syntax.parallel.* -import grackle.Path -import grackle.Predicate -import grackle.Predicate.* -import lucuma.core.enums.ObservationWorkflowState -import lucuma.odb.graphql.binding.* - -object WhereObservationWorkflow { - - def binding(path: Path): Matcher[Predicate] = { - - val StateBinding = WhereEq.binding(path / "state", enumeratedBinding[ObservationWorkflowState]) - - lazy val WhereObservationWorkflowBinding = binding(path) - ObjectFieldsBinding.rmap { - case List( - WhereObservationWorkflowBinding.List.Option("AND", rAND), - WhereObservationWorkflowBinding.List.Option("OR", rOR), - WhereObservationWorkflowBinding.Option("NOT", rNOT), - StateBinding.Option("state", rState), - ) => - (rAND, rOR, rNOT, rState).parMapN { - (AND, OR, NOT, state) => - and(List( - AND.map(and), - OR.map(or), - NOT.map(Not(_)), - state - ).flatten) - } - } - - } - -} - diff --git a/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereProposal.scala b/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereProposal.scala index 3201c6ee6..baf09917b 100644 --- a/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereProposal.scala +++ b/modules/service/src/main/scala/lucuma/odb/graphql/input/WhereProposal.scala @@ -9,15 +9,16 @@ import grackle.Predicate import grackle.Predicate.* import lucuma.odb.graphql.binding.* -object WhereProposal: +object WhereProposal { - def binding(path: Path): Matcher[Predicate] = + def binding(path: Path): Matcher[Predicate] = { val WhereTitleBinding = WhereOptionString.binding(path / "title") val WhereProposalReferenceBinding = WhereProposalReference.binding(path / "reference") - lazy val WhereProposalBinding = binding(path) // lazy self-reference - ObjectFieldsBinding.rmap: + lazy val WhereProposalBinding = binding(path) + + ObjectFieldsBinding.rmap { case List( BooleanBinding.Option("IS_NULL", rIsNull), WhereProposalBinding.List.Option("AND", rAND), @@ -26,7 +27,7 @@ object WhereProposal: WhereTitleBinding.Option("title", rTitle), WhereProposalReferenceBinding.Option("reference", rRef), ) => - (rIsNull, rAND, rOR, rNOT, rTitle, rRef).parMapN: + (rIsNull, rAND, rOR, rNOT, rTitle, rRef).parMapN { (isNull, AND, OR, NOT, title, ref) => and(List( isNull.map(IsNull(path / "program_id", _)), @@ -36,4 +37,8 @@ object WhereProposal: title, ref ).flatten) + } + } + } +}