mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
handle object and array for and operator
This commit is contained in:
parent
3d3d51193e
commit
af21bba606
@ -208,8 +208,8 @@ describe('Filtering API', () => {
|
||||
[{ $null: '1' }],
|
||||
[{ $null: 't' }],
|
||||
[{ $null: 'anything' }],
|
||||
[{ $null: '[]' }],
|
||||
[{ $null: '{}' }],
|
||||
[{ $null: ['anything'] }],
|
||||
[{ $null: { anything: 'anything' } }],
|
||||
[{ $notNull: false }],
|
||||
[{ $notNull: 'false' }],
|
||||
[{ $notNull: '0' }],
|
||||
@ -239,8 +239,8 @@ describe('Filtering API', () => {
|
||||
[{ $notNull: '1' }],
|
||||
[{ $notNull: 't' }],
|
||||
[{ $notNull: 'anything' }],
|
||||
[{ $notNull: '[]' }],
|
||||
[{ $notNull: '{}' }],
|
||||
[{ $notNull: ['anything'] }],
|
||||
[{ $notNull: { anything: 'anything' } }],
|
||||
[{ $null: false }],
|
||||
[{ $null: 'false' }],
|
||||
[{ $null: '0' }],
|
||||
|
||||
@ -287,10 +287,10 @@ const convertAndSanitizeFilters = (filters, schema) => {
|
||||
|
||||
// Handle operators
|
||||
else {
|
||||
if (isObject(value)) {
|
||||
filters[key] = convertAndSanitizeFilters(value, schema);
|
||||
} else if (['$null', '$notNull'].includes(key)) {
|
||||
if (['$null', '$notNull'].includes(key)) {
|
||||
filters[key] = parseType({ type: 'boolean', value: filters[key], forceCast: true });
|
||||
} else if (isObject(value)) {
|
||||
filters[key] = convertAndSanitizeFilters(value, schema);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user