Skip to content

Instantly share code, notes, and snippets.

@bartosz-maciaszek
Last active May 14, 2019 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bartosz-maciaszek/6e033ccfbaf36993682d98841fffb0ee to your computer and use it in GitHub Desktop.
Save bartosz-maciaszek/6e033ccfbaf36993682d98841fffb0ee to your computer and use it in GitHub Desktop.
datamodel.prisma
type User {
id: ID! @id
...
displayName: String!
...
friendships: [Friendship!]
friendshipRequestsSent: [FriendshipRequest!] @relation(name: "FriendshipRequestsSent")
friendshipRequestsReceived: [FriendshipRequest!] @relation(name: "FriendshipRequestsReceived")
....
}
type Friendship {
id: ID! @id
...
users: [User!]!
...
}
type FriendshipRequest {
id: ID! @id
...
from: User! @relation(name: "FriendshipRequestsSent")
to: User! @relation(name: "FriendshipRequestsReceived")
status: FriendshipRequestStatus! @default(value: PENDING)
...
}
enum FriendshipRequestStatus {
PENDING
ACCEPTED
REJECTED
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment