We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am getting the following error when using defaultFilter:
nestjs-query error TS2322: Type is not assignable to type 'Filter<unknown>'.
I have the following DTO:
import { ObjectType, Field, ID, Int, GraphQLISODateTime } from "@nestjs/graphql"; import { Relation, FilterableField, Connection } from '@nestjs-query/query-graphql'; import { PlanDTO } from '../plan/plan.dto'; import { UserDTO } from '../auth/dto/users.dto'; @ObjectType('SubscriptionPlan') @Relation('plan', () => PlanDTO, { disableRemove: true }) @Connection('users', () => UserDTO, { disableRemove: true }) export class SubscriptionPlanDTO { @FilterableField(() => ID) id: number; @FilterableField(() => Int) planId: number; @Field(() => Int) quantity: number; @Field(() => Int) price: number; @Field(() => Int) totalPrice: number; @FilterableField(() => Int) schoolId: number; @Field(() => GraphQLISODateTime ) createdDate: Date; @Field(() => GraphQLISODateTime ) startDate: Date; @Field(() => GraphQLISODateTime ) endDate: Date; @FilterableField() isActive: boolean; }
And module:
import { Module } from '@nestjs/common'; import { NestjsQueryGraphQLModule } from '@nestjs-query/query-graphql'; import { NestjsQueryTypeOrmModule } from '@nestjs-query/query-typeorm'; import { SubscriptionPlan } from './subscriptionplan.entity'; import { SubscriptionPlanDTO } from './subscriptionplan.dto'; import { SubscriptionplanService } from './subscriptionplan.service'; import { GqlAuthGuard } from '../auth/auth-gql.guard'; const guards = [GqlAuthGuard]; @Module({ imports: [ NestjsQueryGraphQLModule.forFeature({ // import the NestjsQueryTypeOrmModule to register the entity with typeorm // and provide a QueryService imports: [NestjsQueryTypeOrmModule.forFeature([SubscriptionPlan])], // describe the resolvers you want to expose resolvers: [{ DTOClass: SubscriptionPlanDTO, EntityClass: SubscriptionPlan, create: { guards }, update: { guards }, delete: { guards, many: { disabled: true } }, read: { defaultFilter: { completed: { is: true } } }, }], }), ], providers: [SubscriptionplanService], }) export class SubscriptionModule { }
I followed this example https://doug-martin.github.io/nestjs-query/docs/graphql/resolvers#default-filter
What am I doing wrong please?
The text was updated successfully, but these errors were encountered:
fix(graphql, #505): Less restrictive readResolverOpts for auto crud
529d6f8
b4e6862
@archer747 thank you for the bug report! I just release v0.19.2 which should address this.
v0.19.2
Thanks again!
Sorry, something went wrong.
Fantastic! Thank you very much for your prompt response!!
I was on v0.18.2.
v0.18.2
No branches or pull requests
I am getting the following error when using defaultFilter:
nestjs-query error TS2322: Type is not assignable to type 'Filter<unknown>'.
I have the following DTO:
And module:
I followed this example https://doug-martin.github.io/nestjs-query/docs/graphql/resolvers#default-filter
What am I doing wrong please?
The text was updated successfully, but these errors were encountered: