0
model Chatroom {
  room_id     Int           @id @default(autoincrement())
  Participant Participant[]
  Message     Message[]
}

model Participant {
  participant_id Int @id @default(autoincrement())

  roomId          Chatroom @relation(fields: [chatroomRoom_id], references: [room_id])
  chatroomRoom_id Int

  user_id User @relation(fields: [userId], references: [id])
  userId  Int
}

Is there a way to find if two target participants have a chatroom together in the Prisma client?

I've tried querying both users rooms and filtering it where I can find the room the two users are in exist but I want to know if there's a way to do this in prisma findFirst.

0 Answers0