diff --git a/caluma/core/filters.py b/caluma/core/filters.py index dc885ae07..878ae92d2 100644 --- a/caluma/core/filters.py +++ b/caluma/core/filters.py @@ -127,6 +127,7 @@ def _get_or_make_field(name, filt): filter_fields = { name: _get_or_make_field(name, filt) for name, filt in _filter_coll.filters.items() + if not isinstance(filt, OrderingFilter) } filter_fields["invert"] = graphene.Boolean(required=False, default=False) diff --git a/caluma/tests/snapshots/snap_test_schema.py b/caluma/tests/snapshots/snap_test_schema.py index 3061b7e4b..ab20c1e5a 100644 --- a/caluma/tests/snapshots/snap_test_schema.py +++ b/caluma/tests/snapshots/snap_test_schema.py @@ -113,7 +113,7 @@ status: CaseStatus! meta: GenericScalar document: Document - workItems(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], status: WorkItemStatusArgument, task: ID, case: ID, orderBy: [WorkItemOrdering], filter: [WorkItemFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, addressedGroups: [String], documentHasAnswer: [HasAnswerFilterType], caseDocumentHasAnswer: [HasAnswerFilterType], caseMetaValue: [JSONValueFilterType]): WorkItemConnection + workItems(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], status: WorkItemStatusArgument, task: ID, case: ID, filter: [WorkItemFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, orderBy: [WorkItemOrdering], addressedGroups: [String], documentHasAnswer: [HasAnswerFilterType], caseDocumentHasAnswer: [HasAnswerFilterType], caseMetaValue: [JSONValueFilterType]): WorkItemConnection parentWorkItem: WorkItem } @@ -134,7 +134,6 @@ createdByGroup: String metaHasKey: String metaValue: [JSONValueFilterType] - orderBy: [CaseOrdering] documentForm: String hasAnswer: [HasAnswerFilterType] searchAnswers: [SearchAnswersFilterType] @@ -407,7 +406,6 @@ createdByGroup: String metaHasKey: String metaValue: [JSONValueFilterType] - orderBy: [DocumentOrdering] rootDocument: ID hasAnswer: [HasAnswerFilterType] searchAnswers: [SearchAnswersFilterType] @@ -610,7 +608,6 @@ } input FormFilterSetType { - orderBy: [FormOrdering] slug: String name: String description: String @@ -1036,13 +1033,13 @@ documentAsOf(id: ID!, asOf: DateTime!): HistoricalDocument allDataSources(before: String, after: String, first: Int, last: Int): DataSourceConnection dataSource(name: String, before: String, after: String, first: Int, last: Int): DataSourceDataConnection - allWorkflows(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], slug: String, name: String, description: String, isPublished: Boolean, isArchived: Boolean, orderBy: [WorkflowOrdering], filter: [WorkflowFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, search: String): WorkflowConnection - allTasks(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], slug: String, name: String, description: String, type: TaskTypeArgument, isArchived: Boolean, orderBy: [TaskOrdering], filter: [TaskFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, search: String): TaskConnection - allCases(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], workflow: ID, orderBy: [CaseOrdering], filter: [CaseFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, documentForm: String, hasAnswer: [HasAnswerFilterType], searchAnswers: [SearchAnswersFilterType], status: [CaseStatusArgument], orderByQuestionAnswerValue: String): CaseConnection - allWorkItems(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], status: WorkItemStatusArgument, orderBy: [WorkItemOrdering], filter: [WorkItemFilterSetType], documentHasAnswer: [HasAnswerFilterType], caseDocumentHasAnswer: [HasAnswerFilterType], caseMetaValue: [JSONValueFilterType], task: ID, case: ID, createdByUser: String, createdByGroup: String, metaHasKey: String, addressedGroups: [String]): WorkItemConnection + allWorkflows(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], slug: String, name: String, description: String, isPublished: Boolean, isArchived: Boolean, filter: [WorkflowFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, search: String, orderBy: [WorkflowOrdering]): WorkflowConnection + allTasks(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], slug: String, name: String, description: String, type: TaskTypeArgument, isArchived: Boolean, filter: [TaskFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, search: String, orderBy: [TaskOrdering]): TaskConnection + allCases(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], workflow: ID, filter: [CaseFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, orderBy: [CaseOrdering], documentForm: String, hasAnswer: [HasAnswerFilterType], searchAnswers: [SearchAnswersFilterType], status: [CaseStatusArgument], orderByQuestionAnswerValue: String): CaseConnection + allWorkItems(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], status: WorkItemStatusArgument, filter: [WorkItemFilterSetType], orderBy: [WorkItemOrdering], documentHasAnswer: [HasAnswerFilterType], caseDocumentHasAnswer: [HasAnswerFilterType], caseMetaValue: [JSONValueFilterType], task: ID, case: ID, createdByUser: String, createdByGroup: String, metaHasKey: String, addressedGroups: [String]): WorkItemConnection allForms(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], orderBy: [FormOrdering], slug: String, name: String, description: String, isPublished: Boolean, isArchived: Boolean, filter: [FormFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, search: String, slugs: [String]): FormConnection allQuestions(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], orderBy: [QuestionOrdering], slug: String, label: String, isRequired: String, isHidden: String, isArchived: Boolean, filter: [QuestionFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, excludeForms: [ID], search: String, slugs: [String]): QuestionConnection - allDocuments(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], form: ID, forms: [ID], search: String, id: ID, orderBy: [DocumentOrdering], filter: [DocumentFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, rootDocument: ID, hasAnswer: [HasAnswerFilterType], searchAnswers: [SearchAnswersFilterType]): DocumentConnection + allDocuments(before: String, after: String, first: Int, last: Int, metaValue: [JSONValueFilterType], form: ID, forms: [ID], search: String, id: ID, filter: [DocumentFilterSetType], createdByUser: String, createdByGroup: String, metaHasKey: String, orderBy: [DocumentOrdering], rootDocument: ID, hasAnswer: [HasAnswerFilterType], searchAnswers: [SearchAnswersFilterType]): DocumentConnection allFormatValidators(before: String, after: String, first: Int, last: Int): FormatValidatorConnection documentValidity(id: ID!, before: String, after: String, first: Int, last: Int): DocumentValidityConnection node(id: ID!): Node @@ -1078,7 +1075,6 @@ } input QuestionFilterSetType { - orderBy: [QuestionOrdering] slug: String label: String isRequired: String @@ -1765,7 +1761,6 @@ metaHasKey: String metaValue: [JSONValueFilterType] search: String - orderBy: [TaskOrdering] invert: Boolean } @@ -1900,7 +1895,6 @@ createdByGroup: String metaHasKey: String metaValue: [JSONValueFilterType] - orderBy: [WorkItemOrdering] addressedGroups: [String] documentHasAnswer: [HasAnswerFilterType] caseDocumentHasAnswer: [HasAnswerFilterType] @@ -1980,7 +1974,6 @@ metaHasKey: String metaValue: [JSONValueFilterType] search: String - orderBy: [WorkflowOrdering] invert: Boolean } diff --git a/docs/graphql.md b/docs/graphql.md index b8d2aab23..5955ffd79 100644 --- a/docs/graphql.md +++ b/docs/graphql.md @@ -90,3 +90,28 @@ query foo { So the above query would return all documents that have a question named "foo" with the value "bar", but exclude all documents from that list where another question "baz" has the value "hello". + +We also intend to syntactically separate ordering from filtering, which +"traditionally" was the same: In REST APIs, you would have query strings +that could configure both filtering and sorting, like this: +`?foo=bar&ordering=blah`. GrahpQL doesn't really provide independent syntax for +this either: `allDocuments(hasAnswer:{question:"foo",value:"bar"},orderBy=MODIFIED_AT_ASC)` + +Our future interface will separate those two concerns in a clean syntactic +manner: + +```graphql +query foo { + allDocuments( + filter: [ + {hasAnswer: {question: "foo", value: "bar"}}, + ... + ], + ordering: [ + ... + ] + ) { + ... + } +} +```