Skip to content

Commit

Permalink
[core] GraphQL: Move document filters to separate _ property/type
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored and saasen committed Feb 27, 2020
1 parent e9d8d35 commit 7cdac71
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function createDocumentFilters() {
return {
name: 'DocumentFilter',
kind: 'InputObject',
isConstraintFilter: true,
fields: [
{
fieldName: 'references',
type: 'ID',
description: 'All documents referencing the given document ID.'
},
{
fieldName: 'is_draft',
type: 'Boolean',
description: 'All documents that are drafts.'
}
]
}
}

module.exports = createDocumentFilters
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const createIntegerFilters = require('./filters/integerFilters')
const createBooleanFilters = require('./filters/booleanFilters')
const createDatetimeFilters = require('./filters/datetimeFilters')
const createDateFilters = require('./filters/dateFilters')
const createDocumentFilters = require('./filters/documentFilters')

const typeAliases = {
Url: 'String',
Expand All @@ -19,7 +20,8 @@ const filterCreators = {
Integer: createIntegerFilters,
Boolean: createBooleanFilters,
Datetime: createDatetimeFilters,
Date: createDateFilters
Date: createDateFilters,
Document: createDocumentFilters
}

function generateTypeFilters(types) {
Expand Down Expand Up @@ -81,14 +83,9 @@ function createFieldFilters(objectType) {
function getDocumentFilters() {
return [
{
fieldName: 'references',
type: 'ID',
description: 'All documents referencing the given document ID.'
},
{
fieldName: 'is_draft',
type: 'Boolean',
description: 'All documents that are drafts.'
fieldName: '_',
type: 'DocumentFilter',
description: 'Apply filters on document level'
}
]
}
Expand Down

0 comments on commit 7cdac71

Please sign in to comment.