Skip to content

Commit

Permalink
Merge branch 'feature-DATAAPI-4_ignore-default-filters-option' into r…
Browse files Browse the repository at this point in the history
…elease-3.2.0
  • Loading branch information
DominicWatson committed Jul 7, 2021
2 parents e684cb3 + ff6092e commit 380ffb2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Additional _optional_ annotation options at the _object_ level are:
* `dataApiQueue`: Specific queue name for this object
* `dataApiSortOrder`: Sort order for paginated results. Default is date last modified ascending.
* `dataApiSavedFilters`: Comma-separated list of saved filters to apply to all requests to this object (e.g. only return active records)
* `dataApiIgnoreDefaultFilters`: Comma-separated list of ignore default filters to apply to all requests to this object
* `dataApiVerbs`: Supported REST HTTP Verbs. If not supplied, all verbs and operations are supported (i.e. GET, POST, PUT and DELETE)
* `dataApiFields`: Fields to return in GET requests (defaults to all non-excluded fields)
* `dataApiUpsertFields`: Fields to accept in POST/PUT request (defaults to `dataApiFields`)
Expand Down Expand Up @@ -265,7 +266,7 @@ or
*/
```

#### Skip a data api queue:
#### Skip a data api queue:

To prevent data api queue to be created when you insert data into an object, you can set `skipDataApiQueue = true` as argument in the `insertData` function. For example:

Expand Down
13 changes: 13 additions & 0 deletions services/DataApiConfigurationService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ component {
} );
}

public array function getIgnoreDefaultFilters( required string entity, string namespace=_getDataApiNamespace() ) {
var args = arguments;
var cacheKey = "getIgnoreDefaultFilters" & args.namespace & args.entity;

return _simpleLocalCache( cacheKey, function(){
var objectName = getEntityObject( args.entity, args.namespace );
var poService = $getPresideObjectService();
var ignoreDefaultFilters = poService.getObjectAttribute( objectName, "dataApiIgnoreDefaultFilters#_getNamespaceWithSeparator( args.namespace )#" );

return listToArray( trim( ignoreDefaultFilters ) );
} );
}

public array function getSelectFields( required string entity, boolean aliases=false ) {
var args = arguments;
var cacheKey = "getSelectFields" & _getDataApiNamespace() & args.entity & args.aliases;
Expand Down
1 change: 1 addition & 0 deletions services/DataApiService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ component {
args.fromVersionTable = false;
args.orderBy = configService.getSelectSortOrder( arguments.entity );
args.savedFilters = configService.getSavedFilters( arguments.entity );
args.ignoreDefaultFilters = configService.getIgnoreDefaultFilters( arguments.entity );
args.allowDraftVersions = false;
args.autoGroupBy = true;
args.distinct = true;
Expand Down

0 comments on commit 380ffb2

Please sign in to comment.