diff --git a/src/lib/Filters.js b/src/lib/Filters.js index 0957775428..df62e35e4d 100644 --- a/src/lib/Filters.js +++ b/src/lib/Filters.js @@ -45,6 +45,9 @@ export const Constraints = { starts: { name: 'starts with', }, + ends: { + name: 'ends with', + }, before: { name: 'is before', field: 'Date', @@ -89,7 +92,7 @@ export const FieldConstraints = { 'Pointer': [ 'exists', 'dne', 'eq', 'neq'], 'Boolean': [ 'exists', 'dne', 'eq' ], 'Number': [ 'exists', 'dne', 'eq', 'neq', 'lt', 'lte', 'gt', 'gte' ], - 'String': [ 'exists', 'dne', 'eq', 'neq', 'starts' ], + 'String': [ 'exists', 'dne', 'eq', 'neq', 'starts', 'ends' ], 'Date': [ 'exists', 'dne', 'before', 'after' ], 'Array': [ 'exists', diff --git a/src/lib/queryFromFilters.js b/src/lib/queryFromFilters.js index c4b6e6ed02..7a182cebd6 100644 --- a/src/lib/queryFromFilters.js +++ b/src/lib/queryFromFilters.js @@ -50,6 +50,9 @@ function addConstraint(query, filter) { case 'starts': query.startsWith(filter.get('field'), filter.get('compareTo')); break; + case 'ends': + query.endsWith(filter.get('field'), filter.get('compareTo')); + break; case 'before': query.lessThan(filter.get('field'), filter.get('compareTo')); break;