Skip to content

Commit

Permalink
refactor: removed unreachable code
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Fiorelli committed Jul 7, 2020
1 parent 48d457d commit b260e84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 1 addition & 5 deletions packages/crud-request/src/request-query.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,7 @@ export class RequestQueryBuilder {
customOperators?: CustomOperators,
): string {
const filter = Array.isArray(f) ? { field: f[0], operator: f[1], value: f[2] } : f;
validateCondition(
filter,
cond,
this ? (this.options ? customOperators : undefined) : undefined,
);
validateCondition(filter, cond, customOperators);
const d = this.options.delim;

return (
Expand Down
9 changes: 1 addition & 8 deletions packages/crud/src/interceptors/crud-request.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ export class CrudRequestInterceptor extends CrudBaseInterceptor
const { ctrlOptions, crudOptions, action } = this.getCrudInfo(context);
const parser = RequestQueryParser.create();

parser.parseQuery(
req.query,
crudOptions
? crudOptions.operators
? crudOptions.operators.custom
: undefined
: undefined,
);
parser.parseQuery(req.query, crudOptions.operators.custom);

if (!isNil(ctrlOptions)) {
const search = this.getSearch(parser, crudOptions, action, req.params);
Expand Down
9 changes: 9 additions & 0 deletions packages/crud/test/crud-config.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ describe('#crud', () => {
query: {
limit: 10,
},
operators: {
custom: {},
},
params: {
id: {
field: 'id',
Expand Down Expand Up @@ -70,6 +73,9 @@ describe('#crud', () => {
query: {
limit: 10,
},
operators: {
custom: {},
},
params: {
id: {
field: 'id',
Expand Down Expand Up @@ -107,6 +113,9 @@ describe('#crud', () => {
expect(CrudConfigService.config.query).toEqual(
expect.objectContaining(expected.query),
);
expect(CrudConfigService.config.operators).toEqual(
expect.objectContaining(expected.operators),
);
expect(JSON.stringify(CrudConfigService.config.routes)).toEqual(
JSON.stringify(expected.routes),
);
Expand Down

0 comments on commit b260e84

Please sign in to comment.