Hi guys, learning Prisma and was wondering how to ...
# orm-help
j
Hi guys, learning Prisma and was wondering how to achieve a unique object/relationship? Such that on this example, would only allow to create entry on a contest, once for every email. Hope i explained myself well enough
Copy code
type Contestant {
  id: ID! @unique
  createdAt: DateTime!
  email: String! @unique
  entries: [Entry!]!
}

type Entry {
  id: ID! @unique
  createdAt: DateTime!
  contestant: Contestant!
  contest: Contest!
}

type Contest {
  id: ID! @unique
  title: String!
  slug: String! @unique
  answer: String!
  entries: [Entry!]! //unique entry contestant?
}
m
This is currently not possible with Prisma out of the box. You would have to ensure this in your business logic layer yourself by checking if a entry for the contest and contestant exists already.
👍🏻 2