webiny-js
webiny-js copied to clipboard
CMS: Add ability to filter entries based on fields inside object field
Is your feature request related to a problem? Please describe.
Currently, when a user creates a cms model, filters are created for the listEntries query based on every field except the object field.
This limitation in searching capability limits the business logic in a way that application code is responsible for filtering data rather than the storage layer (DB). And, in some cases, it is not even possible to write custom code to support this.
Take this content model for example:
{
"name": "Workflow",
"modelId": "workflow",
"fields": [
{
"label": "Title",
"type": "text",
"multipleValues": false,
"predefinedValues": {
"enabled": false,
"values": []
},
"settings": {}
},
{
"label": "App",
"type": "text",
"multipleValues": false,
"predefinedValues": {
"enabled": true,
"values": [
{
"label": "Page Builder",
"value": "pageBuilder"
},
{
"label": "CMS",
"value": "cms"
}
]
},
"settings": {}
},
{
"label": "Scope",
"type": "object",
"multipleValues": false,
"predefinedValues": {
"enabled": false,
"values": []
},
"settings": {
"fields": [
{
"renderer": {
"name": "select-box"
},
"predefinedValues": {
"enabled": true,
"values": [
{
"value": "default",
"label": "Default"
},
{
"value": "pb",
"label": "Page Builder"
},
{
"value": "cms",
"label": "CMS"
}
]
},
"label": "Type",
"id": "33wJFMsY5",
"type": "text",
"validation": [
{
"name": "required",
"message": "Value is required."
}
],
"fieldId": "type"
}
],
"layout": [
[
"33wJFMsY5"
]
]
}
}
]
}
The generated listWorkflows query will have the following where input type:
type WorkflowListWhereInput {
id: ID
id_not: ID
id_in: [ID!]
id_not_in: [ID!]
...
createdBy: String
createdBy_not: String
createdBy_in: [String!]
createdBy_not_in: [String!]
...
title: String
title_not: String
title_in: [String]
title_not_in: [String]
title_contains: String
title_not_contains: String
app: String
app_not: String
app_in: [String]
app_not_in: [String]
app_contains: String
app_not_contains: String
}
It would be really helpful if we could make filters work with the object field.
As we're already creating a filter based on createdBy field (which of object type), maybe we can use that approach and extend it for the object field.
Describe the solution you'd like.
No response
Describe alternatives you've considered.
No response
This issue is stale because it was opened 120 days with no activity. Remove the "stale-issue" label or leave a comment to revive the issue. Otherwise, it will be closed in 7 days.