Example subscriptions based off the prisma2 boilerplate and Ben Awad's video tutorial https://youtu.be/146AypcFvAU
yarn install
yarn start
-> open localhost:4000
mutation{
signupUser(data: {
email: "prisma@subscriptions.com",
name: "Prisma Sub"
}) {
email
}
}
mutation {
createDraft(
title: "Prisma Subscriptions",
content: "Subscriptions are working!"
authorEmail: "prisma@subscriptions.com"
) {
id,
title,
author {
email
}
}
}
# {
# "data": {
# "createDraft": {
# "id": "cjzvn2ckk0000sos951nxi6q1",
# "title": "Prisma Subscriptions"
# }
# }
# }
subscription {
publishedPost {
title,
content,
published,
author {
email
}
}
}
OR filter by email
subscription(authorEmail: "prisma@subscriptions.com") {
publishedPost {
title,
content,
published,
author {
email
}
}
}
# Make sure to use id from step 2
mutation {
publish(
id: "cjzvn2ckk0000sos951nxi6q1"
) {
id,
title
}
}
# {
# "data": {
# "publish": {
# "id": "cjzvn2ckk0000sos951nxi6q1",
# "title": "Prisma Subscriptions"
# }
# }
# }
# {
# "data": {
# "publishedPost": {
# "title": "Prisma Subscriptions",
# "content": "Subscriptions are working!",
# "published": true,
# "author": {
# "email": "prisma@subscriptions.com"
# }
# }
# }
# }
This might help prisma/prisma#454