hey everyone, I have two models and its a 1-1 rela...
# orm-help
a
hey everyone, I have two models and its a 1-1 relation:
Copy code
model User {
  id                  String                @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  firstName           String?
  lastName            String?
  email               String?               @unique
  profile             Profile?
  role                UserRole              @default(USER)
  createdAt           DateTime              @default(now())
  updatedAt           DateTime              @updatedAt

  @@index([id, email])
}

model Profile {
  id          String   @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  user        User     @relation(fields: [userId], references: [id])
  userId      String   @db.Uuid
  displayName String?  @unique
  biography   String?
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
}
im trying to access
user.profile
and it is telling me that the property profile does not exist on the model user. im having trouble understanding why this isnt possible or the right way to do this
r
@Antoin Campbell 👋 Did you include the
profile
when fetching the
user
?
a
yes I did @Ryan
I can see it in the result but typescript is complaining about the property not existing on user
r
Could you share the query you made? It’s possible that the editor is showing the error so restarting might fix it.