I want to resolve docsCount field for ModuleStats but I get an error Error: Undefined resolver type error. Make sure you are providing an explicit object type for the “ModuleStatsResolver”
@ObjectType()
export class ModuleStats {
@Field(() => ID)
_id: string;
@Field()
name: string;
@Field(() => Int)
docsCount: number;
}
@Resolver(() => ModuleStats)
export class ModuleStatsResolver {
@Query(() => ModuleStats)
async getModuleStats(@Args() args: ModuleArgs) {
return await this.moduleService.getStats(args);
}
@ResolveField("docsCount", () => Int)
async getDocsCount(@Parent() moduleStats: ModuleStats) {
return await this.docsService.getCount(moduleStats._id);
}
}