Kelechi Oliver
10/11/2021, 6:54 AMmodel User {
id String @id @default(uuid())
firstName String
lastName String
email String @unique
/// @TypeGraphQL.omit(output: true)
password String
accountType accountType @default(STUDENT)
role role @default(LEARNER)
profileStudent ProfileStudent?
profileTeacher ProfileTeacher?
....
}
I'm using Typegraphql Prisma to generate types shown below,
@TypeGraphQL.ObjectType({
isAbstract: true
})
export class User {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
firstName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
lastName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
email!: string;
password?: string;
@TypeGraphQL.Field(_type => accountType, {
nullable: false
})
accountType!: "STUDENT" | "TEACHER";
@TypeGraphQL.Field(_type => role, {
nullable: false
})
role!: "ADMIN" | "INSTRUCTOR" | "LEARNER";
profileStudent?: ProfileStudent | null;
profileTeacher?: ProfileTeacher | null;
My problem is, the corresponding graphql schema generated does not include profileStudent & profileTeacher
type User {
UserCohort: [UserCohort!]
UserSubject: [UserSubject!]
_count: UserCount
accountType: accountType!
createdAt: DateTime!
email: String!
firstName: String!
id: String!
lastName: String!
messagingId: String
role: role!
status: accountStatus!
token: String
updatedAt: DateTime!
}
does anyone have an idea what might be the issue?Ryan
10/11/2021, 7:18 AM@TypeGraphQL.Field annotation is not present on those fields. Have you excluded them in your schema?Kelechi Oliver
10/11/2021, 7:52 AMmodel User {
id String @id @default(uuid())
firstName String
lastName String
email String @unique
/// @TypeGraphQL.omit(output: true)
password String
accountType accountType @default(STUDENT)
role role @default(LEARNER)
profileStudent ProfileStudent?
profileTeacher ProfileTeacher?
status accountStatus @default(ACTIVE)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Cohort Cohort[]
Subject Subject[]
UserCohort UserCohort[]
UserSubject UserSubject[]
Topic Topic[]
Activity Activity[]
StudentActivity StudentActivity[]
Support Support[]
SupportReply SupportReply[]
Messaging Messaging? @relation(fields: [messagingId], references: [id])
messagingId String?
}Kelechi Oliver
10/11/2021, 7:55 AM@TypeGraphQL.Field and it works, but anytime I regenerate it gets cleared out, also doing this on the entire codebase is a pain