Skip to content
New issue

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

Bug: Type "XxxxxxxFilter" not found in document #114

Open
davidsparkles opened this issue Aug 8, 2019 · 0 comments
Open

Bug: Type "XxxxxxxFilter" not found in document #114

davidsparkles opened this issue Aug 8, 2019 · 0 comments
Labels

Comments

@davidsparkles
Copy link
Collaborator

davidsparkles commented Aug 8, 2019

Package

  • db
  • schema-builder

Describe the bug

In the example below, Project has a relation to ProjectComment for the field comments. Because comments is decorated with QueryPermissions the schema-builder generates the SDL for the subquery for ProjectComment naming the ProjectCommentFilter as type for the optional where parameter of the subquery. Since ProjectComment does not have a decorator for QueryPermissions or MutationPermissions, it does not create the SDL type ProjectCommentFilter leading to the error, shown below.

Solution: Either withdraw the QueryPermissions from comments or give ProjectComment permissions.

To Reproduce

@Entity()
export default class Project extends BaseEntity {
  @PrimaryGeneratedColumn()
  public readonly id!: string;

  @Column({ type: "varchar", gqlType: "String", nullable: true })
  public comment!: string;

  @OneToMany((type) => ProjectComment, "project")
  @QueryPermissions(anyone())
  public comments!: ProjectComment[];
}

@Entity()
export default class ProjectComment extends BaseEntity {
  @PrimaryGeneratedColumn()
  public readonly id!: string;

  @Column({ type: "varchar", gqlType: "String", nullable: true })
  public comment!: string;

  @ManyToOne((type) => Project, "comments")
  public project!: Project;
}
one:b624d9:BootLoader:error 2019-08-07T17:34:34+0300 <error> index.js:80 (BootLoader.<anonymous>) BootLoader.boot.error.caught: Error: Type "ProjectCommentFilter" not found in document.

Expected behavior

To be discussed.

@davidsparkles davidsparkles changed the title Bug: Error when an Entity has no QueryPermission or MutationPermission Bug: Type "XxxxxxxFilter" not found in document Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant