Skip to content

Commit

Permalink
Merge pull request #445 from goldcaddy77/443-base-service-default-fil…
Browse files Browse the repository at this point in the history
…ters

feat(primary-id-field): add default filters
  • Loading branch information
goldcaddy77 authored Apr 27, 2021
2 parents e6a6985 + 1507f44 commit a94e819
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/decorators/PrimaryIdField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { composeMethodDecorators } from '../utils';
import { getCombinedDecorator } from './getCombinedDecorator';

interface PrimaryIdFieldOptions extends DecoratorCommonOptions {
filter?: true | IdWhereOperator[];
filter?: boolean | IdWhereOperator[];
readonly?: boolean;
}

export function PrimaryIdField(options: PrimaryIdFieldOptions = {}): any {
if (typeof options.filter === 'undefined') {
options.filter = ['eq', 'in'];
}

const factories = getCombinedDecorator({
fieldType: 'id',
gqlFieldType: ID,
Expand Down

0 comments on commit a94e819

Please sign in to comment.