Hi everyone, I've got a User schema as shown below...
# orm-help
k
Hi everyone, I've got a User schema as shown below,
Copy code
model 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,
Copy code
@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
Copy code
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?
r
@Kelechi Oliver 👋 The
@TypeGraphQL.Field
annotation is not present on those fields. Have you excluded them in your schema?
k
No @Ryan I've not. This is the exact prima schema
Copy code
model 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?
}
I tried manually adding
@TypeGraphQL.Field
and it works, but anytime I regenerate it gets cleared out, also doing this on the entire codebase is a pain