Guest User

Untitled

a guest
Dec 6th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.77 KB | None | 0 0
  1. {
  2. groupsUsers {
  3. id
  4. group {
  5. id
  6. }
  7. user {
  8. id
  9. name
  10. email
  11. password
  12. type
  13. }
  14. }
  15. }
  16.  
  17. {
  18. "errors": [
  19. {
  20. "message": "Field "group" must not have a selection since type "Int!" has no subfields.",
  21. "locations": [
  22. {
  23. "line": 4,
  24. "column": 11
  25. }
  26. ],
  27. "stack": [
  28. "Field "group" must not have a selection since type "Int!" has no subfields.",
  29. "",
  30. "GraphQL request (4:11)",
  31. "3: id",
  32. "4: group {",
  33. " ^",
  34. "5: id",
  35. "",
  36. " at Object.Field (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\rules\ScalarLeafs.js:50:33)",
  37. " at Object.enter (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:333:29)",
  38. " at Object.enter (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:384:25)",
  39. " at visit (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:251:26)",
  40. " at validate (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\validate.js:63:22)",
  41. " at C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\express-graphql\dist\index.js:154:52",
  42. " at process.internalTickCallback (internal/process/next_tick.js:77:7)"
  43. ]
  44. },
  45. {
  46. "message": "Field "group" argument "id" of type "Int!" is required but not provided.",
  47. "locations": [
  48. {
  49. "line": 4,
  50. "column": 5
  51. }
  52. ],
  53. "stack": [
  54. "Field "group" argument "id" of type "Int!" is required but not provided.",
  55. "",
  56. "GraphQL request (4:5)",
  57. "3: id",
  58. "4: group {",
  59. " ^",
  60. "5: id",
  61. "",
  62. " at Object.leave (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\rules\ProvidedRequiredArguments.js:71:35)",
  63. " at Object.leave (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:354:29)",
  64. " at Object.leave (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:404:21)",
  65. " at visit (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:251:26)",
  66. " at validate (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\validate.js:63:22)",
  67. " at C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\express-graphql\dist\index.js:154:52",
  68. " at process.internalTickCallback (internal/process/next_tick.js:77:7)"
  69. ]
  70. },
  71. {
  72. "message": "Field "user" must not have a selection since type "Int!" has no subfields.",
  73. "locations": [
  74. {
  75. "line": 7,
  76. "column": 10
  77. }
  78. ],
  79. "stack": [
  80. "Field "user" must not have a selection since type "Int!" has no subfields.",
  81. "",
  82. "GraphQL request (7:10)",
  83. "6: }",
  84. "7: user {",
  85. " ^",
  86. "8: id",
  87. "",
  88. " at Object.Field (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\rules\ScalarLeafs.js:50:33)",
  89. " at Object.enter (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:333:29)",
  90. " at Object.enter (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:384:25)",
  91. " at visit (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:251:26)",
  92. " at validate (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\validate.js:63:22)",
  93. " at C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\express-graphql\dist\index.js:154:52",
  94. " at process.internalTickCallback (internal/process/next_tick.js:77:7)"
  95. ]
  96. },
  97. {
  98. "message": "Field "user" argument "id" of type "Int!" is required but not provided.",
  99. "locations": [
  100. {
  101. "line": 7,
  102. "column": 5
  103. }
  104. ],
  105. "stack": [
  106. "Field "user" argument "id" of type "Int!" is required but not provided.",
  107. "",
  108. "GraphQL request (7:5)",
  109. "6: }",
  110. "7: user {",
  111. " ^",
  112. "8: id",
  113. "",
  114. " at Object.leave (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\rules\ProvidedRequiredArguments.js:71:35)",
  115. " at Object.leave (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:354:29)",
  116. " at Object.leave (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:404:21)",
  117. " at visit (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\language\visitor.js:251:26)",
  118. " at validate (C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\graphql\validation\validate.js:63:22)",
  119. " at C:\Users\Администратор.WIN-T6JHM2R3APV\Documents\GitHub\vertex-edu-server\node_modules\express-graphql\dist\index.js:154:52",
  120. " at process.internalTickCallback (internal/process/next_tick.js:77:7)"
  121. ]
  122. }
  123. ]
  124. }
  125.  
  126. const User=new GraphQLObjectType({
  127. name:'User',
  128. fields: () => {
  129. return ({
  130. id: {type: new GraphQLNonNull(GraphQLInt)},
  131. name: {type: new GraphQLNonNull(GraphQLString)},
  132. email: {type: new GraphQLNonNull(GraphQLString)},
  133. password: {type: new GraphQLNonNull(GraphQLString)},
  134. type: {type: new GraphQLNonNull(GraphQLString)}
  135. });
  136. }
  137. });
  138.  
  139. const Group=new GraphQLObjectType({
  140. name:'Group',
  141. fields: () => {
  142. return ({
  143. id: {type: new GraphQLNonNull(GraphQLInt)}
  144. });
  145. }
  146. });
  147.  
  148. const GroupUser=new GraphQLObjectType({
  149. name:'GroupUser',
  150. fields: () => {
  151. return ({
  152. id: {type: new GraphQLNonNull(GraphQLInt)},
  153. group: {
  154. type: new GraphQLNonNull(GraphQLInt),
  155. fields: () => {
  156. return ({
  157. id: {type: new GraphQLNonNull(GraphQLInt)}
  158. });
  159. },
  160. args: {
  161. id: {type: new GraphQLNonNull(GraphQLInt)}
  162. },
  163. resolve: async function (source, {id}) {
  164. return (await util.searchSql($sql.groupQueryById, id))[0];
  165. }
  166. },
  167. user: {
  168. type: new GraphQLNonNull(GraphQLInt),
  169. fields: () => {
  170. return ({
  171. id: {type: new GraphQLNonNull(GraphQLInt)},
  172. name: {type: new GraphQLNonNull(GraphQLString)},
  173. email: {type: new GraphQLNonNull(GraphQLString)},
  174. password: {type: new GraphQLNonNull(GraphQLString)},
  175. type: {type: new GraphQLNonNull(GraphQLString)}
  176. });
  177. },
  178. args: {
  179. id: {type: new GraphQLNonNull(GraphQLInt)}
  180. },
  181. resolve: async function (source, {id}) {
  182. return (await util.searchSql($sql.userQueryById, [id]))[0];
  183. }
  184. }
  185. });
  186. },
  187. });
  188.  
  189. module.exports = {
  190. query: {
  191. user: {
  192. type: new GraphQLList(User),
  193. args: {
  194. id: {type: new GraphQLNonNull(GraphQLInt)},
  195. },
  196. resolve: async function (source, {id}) {
  197. return await (util.searchSql($sql.userQueryById, [id]));
  198. }
  199. },
  200. users: {
  201. type: new GraphQLList(User),
  202. resolve: async function () {
  203. return await util.searchSql($sql.userQueryAll);
  204. }
  205. },
  206. group: {
  207. type: new GraphQLList(Group),
  208. args: {
  209. id: {type: new GraphQLNonNull(GraphQLInt)}
  210. },
  211. resolve: async function ({id}) {
  212. return await (util.searchSql($sql.groupQueryById, [id]))[0];
  213. }
  214. },
  215. groups: {
  216. type: new GraphQLList(Group),
  217. resolve: async function () {
  218. return await util.searchSql($sql.groupQueryAll);
  219. }
  220. },
  221. groupUser: {
  222. type: new GraphQLList(GroupUser),
  223. args: {
  224. id: {type: new GraphQLNonNull(GraphQLInt)}
  225. },
  226. resolve: async function ({id}) {
  227. return await (util.searchSql($sql.groupUserQueryById, [id]))[0];
  228. }
  229. },
  230. groupsUsers: {
  231. type: new GraphQLList(GroupUser),
  232. resolve: async function () {
  233. return await util.searchSql($sql.groupUserQueryAll);
  234. }
  235. }
  236. }
  237. };
Add Comment
Please, Sign In to add comment