Guest User

Untitled

a guest
Jan 24th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. node --version
  2. v11.6.0
  3.  
  4. {
  5. "dependencies": {
  6. "graphql-yoga": "^1.17.0",
  7. "prisma-client-lib": "^1.25.3"
  8. },
  9. ...
  10. }
  11.  
  12. version: '3'
  13. services:
  14. prisma:
  15. image: prismagraphql/prisma:1.25
  16. restart: always
  17. ports:
  18. - "4466:4466"
  19. environment:
  20. PRISMA_CONFIG: |
  21. port: 4466
  22. databases:
  23. default:
  24. connector: postgres
  25. host: postgres
  26. port: 5432
  27. user: prisma
  28. password: prisma
  29. migrations: true
  30. postgres:
  31. image: postgres:10.5
  32. restart: always
  33. environment:
  34. POSTGRES_USER: prisma
  35. POSTGRES_PASSWORD: prisma
  36. volumes:
  37. - postgres:/var/lib/postgresql/data
  38. volumes:
  39. postgres:
  40.  
  41. type Game {
  42. id: ID! @unique
  43. createdAt: DateTime!
  44. updatedAt: DateTime!
  45. board: String
  46. playerOne: User
  47. }
  48.  
  49. type User {
  50. id: ID! @unique
  51. createdAt: DateTime!
  52. wins: Int
  53. }
  54.  
  55. mutation {
  56. createGame(userId: "cjraz4ogb000s0894lbrugksi") {
  57. id
  58. board
  59. playerOne {
  60. id
  61. }
  62. }
  63. }
  64.  
  65. async function createGame(parent, args, context, info) {
  66. const game = await context.prisma.createGame({
  67. playerOne: { connect: { id: args.userId } },
  68. board: "[[]]"
  69. })
  70. return game
  71. }
  72.  
  73. {
  74. "data": {
  75. "createGame": {
  76. "id": "cjraz8iwr001e08940ok9luki",
  77. "board": "[[]]",
  78. "playerOne": null
  79. }
  80. }
  81. }
  82.  
  83. {
  84. "data": {
  85. "createGame": {
  86. "id": "cjraz8iwr001e08940ok9luki",
  87. "board": "[[]]",
  88. "playerOne": {
  89. id: "cjraz8iwr001e08940ok9luki" <- id from above
  90. }
  91. }
  92. }
  93. }
Add Comment
Please, Sign In to add comment