-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
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.
Reactions are currently unavailable