Skip to content

Commit

Permalink
Merge pull request #3 from zbarbuto/master
Browse files Browse the repository at this point in the history
Make custom property on options optional
  • Loading branch information
zaro committed Jun 29, 2022
2 parents 3199297 + 79b7954 commit 83426c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/crud-typeorm/src/typeorm-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ export class TypeOrmCrudService<T> extends CrudService<T, DeepPartial<T>> {
builder.select(select);

// search
this.setSearchCondition(builder, parsed.search, options.operators.custom);
this.setSearchCondition(builder, parsed.search, options.operators?.custom);

// set joins
const joinOptions = options.query.join || {};
const joinOptions = options.query?.join || {};
const allowedJoins = objKeys(joinOptions);

if (hasLength(allowedJoins)) {
Expand Down Expand Up @@ -431,7 +431,7 @@ export class TypeOrmCrudService<T> extends CrudService<T, DeepPartial<T>> {
: await this.createBuilder(parsed, options, true, withDeleted);

if (shallow) {
this.setSearchCondition(builder, parsed.search, options.operators.custom);
this.setSearchCondition(builder, parsed.search, options.operators?.custom);
}

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

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

if (!isNil(ctrlOptions)) {
const search = this.getSearch(parser, crudOptions, action, req.params);
Expand Down

0 comments on commit 83426c8

Please sign in to comment.