Skip to content

How to override the FilterType to make sure a date range is provided? #1523

Open
@GP4cK

Description

@GP4cK

📚 Documentation

I'm trying to force the user to provide a date range when querying tasks using @FilterableField({ filterRequired: true, allowedComparisons: ['between'] }). However, when I start the app, I get this error and I can't find how to fix it:

./node_modules/@nestjs/graphql/dist/utils/reflection.utilts.js:15
        throw new undefined_type_error_1.UndefinedTypeError((0, lodash_1.get)(prototype, 'constructor.name'), propertyKey, index);
              ^
Error: Undefined type error. Make sure you are providing an explicit type for the "date" of the "TaskCalendarFilter" class.

Here's my code:

@ObjectType('TaskCalendarFilter')
@QueryOptions({ pagingStrategy: PagingStrategies.NONE })
class TaskCalendarFilter extends TaskCalendar {
  @FilterableField({ filterRequired: true, allowedComparisons: ['between'] })
  date: CommonFieldComparisonBetweenType<number>
}

@ArgsType()
export class TaskCalendarQuery extends QueryArgsType(TaskCalendarFilter) {}

Have you read the Contributing Guidelines on issues?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions