Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node --version
- v11.6.0
- {
- "dependencies": {
- "graphql-yoga": "^1.17.0",
- "prisma-client-lib": "^1.25.3"
- },
- ...
- }
- version: '3'
- services:
- prisma:
- image: prismagraphql/prisma:1.25
- restart: always
- ports:
- - "4466:4466"
- environment:
- PRISMA_CONFIG: |
- port: 4466
- databases:
- default:
- connector: postgres
- host: postgres
- port: 5432
- user: prisma
- password: prisma
- migrations: true
- postgres:
- image: postgres:10.5
- restart: always
- environment:
- POSTGRES_USER: prisma
- POSTGRES_PASSWORD: prisma
- volumes:
- - postgres:/var/lib/postgresql/data
- volumes:
- postgres:
- type Game {
- id: ID! @unique
- createdAt: DateTime!
- updatedAt: DateTime!
- board: String
- playerOne: User
- }
- type User {
- id: ID! @unique
- createdAt: DateTime!
- wins: Int
- }
- mutation {
- createGame(userId: "cjraz4ogb000s0894lbrugksi") {
- id
- board
- playerOne {
- id
- }
- }
- }
- async function createGame(parent, args, context, info) {
- const game = await context.prisma.createGame({
- playerOne: { connect: { id: args.userId } },
- board: "[[]]"
- })
- return game
- }
- {
- "data": {
- "createGame": {
- "id": "cjraz8iwr001e08940ok9luki",
- "board": "[[]]",
- "playerOne": null
- }
- }
- }
- {
- "data": {
- "createGame": {
- "id": "cjraz8iwr001e08940ok9luki",
- "board": "[[]]",
- "playerOne": {
- id: "cjraz8iwr001e08940ok9luki" <- id from above
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment