Skip to content

Commit

Permalink
fix: renamed option
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkhalidbashir committed Sep 26, 2023
1 parent 124e50b commit f06b493
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ describe('filter types', (): void => {
@FilterableField()
boolField!: boolean

@FilterableField({ filterTypeNamePrefix: `MyDate` })
@FilterableField({ overrideFilterTypeNamePrefix: `MyDate` })
dateField!: Date

@FilterableField({ filterTypeNamePrefix: `MyCustomFloat` })
@FilterableField({ overrideFilterTypeNamePrefix: `MyCustomFloat` })
floatField!: number
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type FilterableFieldOptions = {
filterRequired?: boolean
filterOnly?: boolean
filterDecorators?: PropertyDecorator[]
filterTypeNamePrefix?: string
overrideFilterTypeNamePrefix?: string
} & FieldOptions

export interface FilterableFieldDescriptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const isCustomFieldComparison = <T>(options: FilterComparisonOptions<T>): boolea
!!options.allowedComparisons || !!options.decorators

const getComparisonTypeName = <T>(fieldType: ReturnTypeFuncValue, options: FilterComparisonOptions<T>): string => {
if (options.typeNamePrefix) {
return `${options.typeNamePrefix}FilterComparison`
if (options.overrideTypeNamePrefix) {
return `${options.overrideTypeNamePrefix}FilterComparison`
}
if (isCustomFieldComparison(options)) {
return `${upperCaseFirst(options.fieldName)}FilterComparison`
Expand All @@ -85,7 +85,7 @@ type FilterComparisonOptions<T> = {
allowedComparisons?: FilterComparisonOperators<T>[]
returnTypeFunc?: ReturnTypeFunc<ReturnTypeFuncValue>
decorators?: PropertyDecorator[]
typeNamePrefix?: string
overrideTypeNamePrefix?: string
}

/** @internal */
Expand Down
2 changes: 1 addition & 1 deletion packages/query-graphql/src/types/query/filter.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function getOrCreateFilterType<T>(
allowedComparisons: advancedOptions?.allowedComparisons,
returnTypeFunc,
decorators: advancedOptions?.filterDecorators,
typeNamePrefix: advancedOptions?.filterTypeNamePrefix
overrideTypeNamePrefix: advancedOptions?.overrideFilterTypeNamePrefix
})
const nullable = advancedOptions?.filterRequired !== true
ValidateNested()(GraphQLFilter.prototype, propertyName)
Expand Down

0 comments on commit f06b493

Please sign in to comment.