- NEST js, TypeOrm, Graphql I don't have Idea why I'm having this error, doesn't exit any other type with the same name I need this form because. I'm using jsonb, for the data, this is the reason I have nested objects.
ERROR:
Waiting for the debugger to disconnect...
/Users/angelzapata/Desktop/Work/compass-backend/node_modules/graphql/type/schema.js:219
throw new Error(
^
Error: Schema must contain uniquely named types but contains multiple types named "activityInterface".
//#region Activity
@InterfaceType("activityInterface")
export abstract class ActivityInterface {
@Field(() => String)
name: string;
@Field(() => String, { nullable: true })
description?: string;
@Field(() => String)
type: ActivityType;
@Field(() => String)
picture_rule: ActivityRule;
// @Field(() => File, { nullable: true })
// picture?: File;
@Field()
comment_rule: ActivityRule;
@Field(() => String, { nullable: true })
comment?: string;
// @Field(() => ActivityForm)
// input_form: ActivityForm;
}
// Output
@ObjectType("activityOutput", { implements: ActivityInterface })
export class ActivityOutput implements ActivityInterface {
@Field(() => String)
name: string;
@Field(() => String, { nullable: true })
description?: string;
@Field(() => String)
type: ActivityType;
@Field(() => String)
picture_rule: ActivityRule;
// @Field(() => File, { nullable: true })
// picture?: File;
@Field()
comment_rule: ActivityRule;
@Field(() => String, { nullable: true })
comment?: string;
// @Field(() => ActivityFormOutput)
// input_form: ActivityFormOutput;
}
// Input
@InputType("activityInput")
export class ActivityInput implements ActivityInterface {
@IsNotEmpty()
@IsString()
@Field(() => String)
name: string;
@IsOptional()
@IsString()
@Field(() => String, { nullable: true })
description?: string;
@IsNotEmpty()
@IsEnum(ActivityType)
@Field(() => String)
type: ActivityType;
@IsNotEmpty()
@IsEnum(ActivityRule)
@Field(() => String)
picture_rule: ActivityRule;
// @IsOptional()
// @Field(() => File, { nullable: true })
// picture?: File;
@IsNotEmpty()
@IsEnum(ActivityRule)
@Field()
comment_rule: ActivityRule;
@IsOptional()
@IsString()
@Field({ nullable: true })
comment?: string;
// @ValidateNested()
// @Field(() => ActivityFormInput)
// input_form: ActivityFormInput;
}
//#endregion Activity
//#region ServiceTemplateSection
@InterfaceType("serviceTemplateSectionInterface")
export abstract class ServiceTemplateSection {
@Field(() => String)
name: string;
@Field(() => [ActivityInterface])
activities: ActivityInterface[];
}
// Output
@ObjectType("serviceTemplateSectionOutput", {
implements: ServiceTemplateSection,
})
export class ServiceTemplateSectionOutput implements ServiceTemplateSection {
@Field(() => String)
name: string;
@Field(() => [ActivityOutput])
activities: ActivityOutput[];
}
// Input
@InputType("serviceTemplateSectionInput")
export class ServiceTemplateSectionInput {
@IsNotEmpty()
@IsString()
@Field(() => String)
name: string;
// @ValidateNested({ each: true })
@Field(() => [ActivityInput])
activities: ActivityInput[];
}
//#endregion ServiceTemplateSection
I don't find any solution on internet, have anyone had the same problem? how did you resolve that?