-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf8ac77
commit a3a5167
Showing
4 changed files
with
136 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const { | ||
GraphQLSchema, | ||
GraphQLObjectType, | ||
GraphQLString, | ||
GraphQLList, | ||
GraphQLBoolean, | ||
GraphQLInt | ||
} = require('graphql'); | ||
|
||
const User = require('./users.model'); | ||
|
||
var users = new GraphQLObjectType({ | ||
name: 'user', | ||
description: 'Lista de Usuários', | ||
fields: () => ({ | ||
_id:{ | ||
type:(GraphQLInt), | ||
description:'Identificador único do usuário' | ||
}, | ||
username: { | ||
type: GraphQLString, | ||
description: 'Nome do Usuário.', | ||
}, | ||
email: { | ||
type: GraphQLString, | ||
description: 'Email do Usuário' | ||
}, | ||
password:{ | ||
type:GraphQLString, | ||
description:'Senha do Usuário' | ||
}, | ||
createdAt:{ | ||
type:GraphQLString, | ||
description:'Data de criação' | ||
}, | ||
tipo:{ | ||
type:GraphQLString | ||
} | ||
}) | ||
}); | ||
|
||
let schema = new GraphQLSchema({ | ||
query: new GraphQLObjectType({ | ||
name:'users', | ||
fields:{ | ||
user: { | ||
type:new GraphQLList(users), | ||
resolve:()=>{ | ||
return new Promise((resolve, reject)=>{ | ||
User.find().then(user=>{ | ||
resolve(user); | ||
}).catch(err=>{ | ||
reject(err) | ||
}) | ||
}) | ||
} | ||
} | ||
} | ||
}) | ||
}) | ||
module.exports = { schema }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,13 @@ [email protected]: | |
version "1.0.9" | ||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" | ||
|
||
accepts@^1.3.0: | ||
version "1.3.4" | ||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.4.tgz#86246758c7dd6d21a6474ff084a4740ec05eb21f" | ||
dependencies: | ||
mime-types "~2.1.16" | ||
negotiator "0.6.1" | ||
|
||
accepts@~1.3.3: | ||
version "1.3.3" | ||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.3.tgz#c3ca7434938648c3e0d9c1e328dd68b622c284ca" | ||
|
@@ -593,6 +600,10 @@ [email protected]: | |
version "2.5.0" | ||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.5.0.tgz#4c9423ea2d252c270c41b2bdefeff9bb6b62c06a" | ||
|
||
[email protected]: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" | ||
|
||
caller-path@^0.1.0: | ||
version "0.1.0" | ||
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" | ||
|
@@ -883,6 +894,10 @@ content-type-parser@^1.0.1: | |
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.1.tgz#c3e56988c53c65127fb46d4032a3a900246fdc94" | ||
|
||
content-type@^1.0.2: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" | ||
|
||
content-type@~1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.2.tgz#b7d113aee7a8dd27bd21133c4dc2529df1721eed" | ||
|
@@ -1073,7 +1088,7 @@ [email protected]: | |
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3" | ||
|
||
depd@^1.1.0, depd@~1.1.0, depd@~1.1.1: | ||
depd@1.1.1, depd@^1.1.0, depd@~1.1.0, depd@~1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" | ||
|
||
|
@@ -1523,6 +1538,15 @@ expect@^21.1.0: | |
jest-message-util "^21.1.0" | ||
jest-regex-util "^21.1.0" | ||
|
||
express-graphql@^0.6.11: | ||
version "0.6.11" | ||
resolved "https://registry.yarnpkg.com/express-graphql/-/express-graphql-0.6.11.tgz#3dce78d0643e78e7e3606646ce162025ba0585ab" | ||
dependencies: | ||
accepts "^1.3.0" | ||
content-type "^1.0.2" | ||
http-errors "^1.3.0" | ||
raw-body "^2.1.0" | ||
|
||
express-session@^1.15.5: | ||
version "1.15.5" | ||
resolved "https://registry.yarnpkg.com/express-session/-/express-session-1.15.5.tgz#f49a18227263b316f6f8544da5fee25a540259ec" | ||
|
@@ -1929,6 +1953,12 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: | |
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" | ||
|
||
graphql@^0.11.7: | ||
version "0.11.7" | ||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.7.tgz#e5abaa9cb7b7cccb84e9f0836bf4370d268750c6" | ||
dependencies: | ||
iterall "1.1.3" | ||
|
||
[email protected]: | ||
version "1.9.2" | ||
resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" | ||
|
@@ -2064,6 +2094,15 @@ html-encoding-sniffer@^1.0.1: | |
dependencies: | ||
whatwg-encoding "^1.0.1" | ||
|
||
[email protected], http-errors@^1.3.0: | ||
version "1.6.2" | ||
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.2.tgz#0a002cc85707192a7e7946ceedc11155f60ec736" | ||
dependencies: | ||
depd "1.1.1" | ||
inherits "2.0.3" | ||
setprototypeof "1.0.3" | ||
statuses ">= 1.3.1 < 2" | ||
|
||
http-errors@~1.6.1: | ||
version "1.6.1" | ||
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.1.tgz#5f8b8ed98aca545656bf572997387f904a722257" | ||
|
@@ -2093,14 +2132,14 @@ [email protected]: | |
version "0.4.15" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" | ||
|
||
[email protected], iconv-lite@^0.4.4: | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" | ||
|
||
iconv-lite@^0.4.17: | ||
version "0.4.18" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" | ||
|
||
iconv-lite@^0.4.4: | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" | ||
|
||
[email protected]: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/ienoopen/-/ienoopen-1.0.0.tgz#346a428f474aac8f50cf3784ea2d0f16f62bda6b" | ||
|
@@ -2447,6 +2486,10 @@ [email protected]: | |
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198" | ||
|
||
[email protected]: | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.3.tgz#1cbbff96204056dde6656e2ed2e2226d0e6d72c9" | ||
|
||
jest-changed-files@^20.0.3: | ||
version "20.0.3" | ||
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.3.tgz#9394d5cc65c438406149bef1bf4d52b68e03e3f8" | ||
|
@@ -3305,12 +3348,22 @@ micromatch@^2.1.5, micromatch@^2.3.11: | |
version "1.29.0" | ||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878" | ||
|
||
mime-db@~1.30.0: | ||
version "1.30.0" | ||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" | ||
|
||
mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.7: | ||
version "2.1.16" | ||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.16.tgz#2b858a52e5ecd516db897ac2be87487830698e23" | ||
dependencies: | ||
mime-db "~1.29.0" | ||
|
||
mime-types@~2.1.16: | ||
version "2.1.17" | ||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" | ||
dependencies: | ||
mime-db "~1.30.0" | ||
|
||
[email protected]: | ||
version "1.3.4" | ||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" | ||
|
@@ -4084,6 +4137,15 @@ range-parser@~1.2.0: | |
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" | ||
|
||
raw-body@^2.1.0: | ||
version "2.3.2" | ||
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" | ||
dependencies: | ||
bytes "3.0.0" | ||
http-errors "1.6.2" | ||
iconv-lite "0.4.19" | ||
unpipe "1.0.0" | ||
|
||
raw-body@~2.2.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.2.0.tgz#994976cf6a5096a41162840492f0bdc5d6e7fb96" | ||
|