Package
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.
Package
Describe the bug
In the example below,
Projecthas a relation toProjectCommentfor the fieldcomments. Becausecommentsis decorated withQueryPermissionstheschema-buildergenerates the SDL for the subquery forProjectCommentnaming theProjectCommentFilteras type for the optionalwhereparameter of the subquery. SinceProjectCommentdoes not have a decorator forQueryPermissionsorMutationPermissions, it does not create the SDL typeProjectCommentFilterleading to the error, shown below.Solution: Either withdraw the
QueryPermissionsfromcommentsor giveProjectCommentpermissions.To Reproduce
Expected behavior
To be discussed.