mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
some cleanup
This commit is contained in:
parent
58dfc281f7
commit
513de69bf9
@ -6,6 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "./node_modules/.bin/nodemon --exec babel-node src/index.js",
|
"start": "./node_modules/.bin/nodemon --exec babel-node src/index.js",
|
||||||
|
"start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js",
|
||||||
"seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.js"
|
"seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.js"
|
||||||
},
|
},
|
||||||
"author": "Grzegorz Leoniec",
|
"author": "Grzegorz Leoniec",
|
||||||
@ -19,14 +20,14 @@
|
|||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"dotenv": "^6.0.0",
|
"dotenv": "^6.0.0",
|
||||||
"graphql-custom-directives": "^0.2.13",
|
"graphql-custom-directives": "^0.2.13",
|
||||||
"graphql-middleware": "^1.7.6",
|
"graphql-middleware": "1.7.6",
|
||||||
"graphql-tag": "^2.9.2",
|
"graphql-tag": "^2.9.2",
|
||||||
"graphql-yoga": "^1.16.2",
|
"graphql-yoga": "1.16.2",
|
||||||
"jsonwebtoken": "^8.3.0",
|
"jsonwebtoken": "^8.3.0",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.11",
|
||||||
"ms": "^2.1.1",
|
"ms": "^2.1.1",
|
||||||
"neo4j-driver": "^1.6.1",
|
"neo4j-driver": "^1.6.1",
|
||||||
"neo4j-graphql-js": "^1.0.2",
|
"neo4j-graphql-js": "1.0.4",
|
||||||
"node-fetch": "^2.1.2",
|
"node-fetch": "^2.1.2",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
"passport-jwt": "^4.0.0",
|
"passport-jwt": "^4.0.0",
|
||||||
|
|||||||
@ -4,15 +4,14 @@ import ms from 'ms'
|
|||||||
|
|
||||||
// Generate an Access Token for the given User ID
|
// Generate an Access Token for the given User ID
|
||||||
export default function generateJwt(user) {
|
export default function generateJwt(user) {
|
||||||
console.log('generateJwt', user)
|
|
||||||
const token = jwt.sign(user, process.env.JWT_SECRET, {
|
const token = jwt.sign(user, process.env.JWT_SECRET, {
|
||||||
expiresIn: ms('1d'),
|
expiresIn: ms('1d'),
|
||||||
issuer: process.env.GRAPHQL_URI,
|
issuer: process.env.GRAPHQL_URI,
|
||||||
audience: process.env.CLIENT_URI,
|
audience: process.env.CLIENT_URI,
|
||||||
subject: user.id.toString()
|
subject: user.id.toString()
|
||||||
})
|
})
|
||||||
jwt.verify(token, process.env.JWT_SECRET, (err, data) => {
|
// jwt.verify(token, process.env.JWT_SECRET, (err, data) => {
|
||||||
console.log('token verification:', err, data)
|
// console.log('token verification:', err, data)
|
||||||
})
|
// })
|
||||||
return token
|
return token
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ export default () => {
|
|||||||
|
|
||||||
return new Strategy(options,
|
return new Strategy(options,
|
||||||
(JWTPayload, next) => {
|
(JWTPayload, next) => {
|
||||||
console.log('JWT Payload Received:', JWTPayload)
|
|
||||||
// usually this would be a database call:
|
// usually this would be a database call:
|
||||||
// var user = users[_.findIndex(users, {id: JWTPayload.id})]
|
// var user = users[_.findIndex(users, {id: JWTPayload.id})]
|
||||||
if (true) {
|
if (true) {
|
||||||
|
|||||||
@ -4,17 +4,29 @@ export default {
|
|||||||
if (typeof args.deleted !== 'boolean') {
|
if (typeof args.deleted !== 'boolean') {
|
||||||
args.deleted = false
|
args.deleted = false
|
||||||
}
|
}
|
||||||
const result = await resolve(root, args, context, info)
|
if (typeof args.disabled !== 'boolean') {
|
||||||
return result
|
args.disabled = false
|
||||||
},
|
|
||||||
Comment: async (resolve, root, args, context, info) => {
|
|
||||||
if (typeof args.deleted !== 'boolean') {
|
|
||||||
args.deleted = false
|
|
||||||
}
|
}
|
||||||
const result = await resolve(root, args, context, info)
|
const result = await resolve(root, args, context, info)
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
|
Comment: async (resolve, root, args, context, info) => {
|
||||||
|
// if (typeof args.deleted !== 'boolean') {
|
||||||
|
// args.deleted = false
|
||||||
|
// }
|
||||||
|
// if (typeof args.disabled !== 'boolean') {
|
||||||
|
// args.disabled = false
|
||||||
|
// }
|
||||||
|
const result = await resolve(root, args, context, info)
|
||||||
|
return result
|
||||||
|
},
|
||||||
User: async (resolve, root, args, context, info) => {
|
User: async (resolve, root, args, context, info) => {
|
||||||
|
if (typeof args.deleted !== 'boolean') {
|
||||||
|
args.deleted = false
|
||||||
|
}
|
||||||
|
if (typeof args.disabled !== 'boolean') {
|
||||||
|
args.disabled = false
|
||||||
|
}
|
||||||
// console.log('ROOT', root)
|
// console.log('ROOT', root)
|
||||||
// console.log('ARGS', args)
|
// console.log('ARGS', args)
|
||||||
// console.log('CONTEXT', context)
|
// console.log('CONTEXT', context)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export default `
|
|||||||
avatar
|
avatar
|
||||||
role
|
role
|
||||||
}
|
}
|
||||||
u3: CreateUser(id: "u3", name: "Jenny Rostock", password: "1234", email: "user@test.de", avatar: "${faker.internet.avatar()}", role: Admin) {
|
u3: CreateUser(id: "u3", name: "Jenny Rostock", password: "1234", email: "user@test.de", avatar: "${faker.internet.avatar()}", role: User) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
email
|
email
|
||||||
|
|||||||
3862
yarn-error.log
Normal file
3862
yarn-error.log
Normal file
File diff suppressed because it is too large
Load Diff
18
yarn.lock
18
yarn.lock
@ -1904,11 +1904,11 @@ graphql-middleware@1.6.6:
|
|||||||
dependencies:
|
dependencies:
|
||||||
graphql-tools "^3.0.5"
|
graphql-tools "^3.0.5"
|
||||||
|
|
||||||
graphql-middleware@^1.7.6:
|
graphql-middleware@1.7.6:
|
||||||
version "1.7.7"
|
version "1.7.6"
|
||||||
resolved "https://registry.yarnpkg.com/graphql-middleware/-/graphql-middleware-1.7.7.tgz#0a7a7193a873c4769401df2aef4ffb9c6ca97f43"
|
resolved "https://registry.yarnpkg.com/graphql-middleware/-/graphql-middleware-1.7.6.tgz#f226bf6671f3d82a9378f8b335804c8e44d21733"
|
||||||
dependencies:
|
dependencies:
|
||||||
graphql-tools "^4.0.1"
|
graphql-tools "^4.0.0"
|
||||||
|
|
||||||
graphql-playground-html@1.5.5:
|
graphql-playground-html@1.5.5:
|
||||||
version "1.5.5"
|
version "1.5.5"
|
||||||
@ -1960,9 +1960,9 @@ graphql-tools@^3.0.0, graphql-tools@^3.0.4, graphql-tools@^3.0.5:
|
|||||||
iterall "^1.1.3"
|
iterall "^1.1.3"
|
||||||
uuid "^3.1.0"
|
uuid "^3.1.0"
|
||||||
|
|
||||||
graphql-tools@^4.0.1:
|
graphql-tools@^4.0.0:
|
||||||
version "4.0.1"
|
version "4.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-4.0.1.tgz#c995a4e25c2967d108c975e508322d12969c8c0e"
|
resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-4.0.2.tgz#9da22974cc6bf6524ed4f4af35556fd15aa6516d"
|
||||||
dependencies:
|
dependencies:
|
||||||
apollo-link "^1.2.3"
|
apollo-link "^1.2.3"
|
||||||
apollo-utilities "^1.0.1"
|
apollo-utilities "^1.0.1"
|
||||||
@ -1970,7 +1970,7 @@ graphql-tools@^4.0.1:
|
|||||||
iterall "^1.1.3"
|
iterall "^1.1.3"
|
||||||
uuid "^3.1.0"
|
uuid "^3.1.0"
|
||||||
|
|
||||||
graphql-yoga@^1.16.2:
|
graphql-yoga@1.16.2:
|
||||||
version "1.16.2"
|
version "1.16.2"
|
||||||
resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-1.16.2.tgz#083293a9cecab6283e883c5a482c5c920fa66585"
|
resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-1.16.2.tgz#083293a9cecab6283e883c5a482c5c920fa66585"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -2709,7 +2709,7 @@ neo4j-driver@^1.6.1:
|
|||||||
babel-runtime "^6.18.0"
|
babel-runtime "^6.18.0"
|
||||||
uri-js "^4.2.1"
|
uri-js "^4.2.1"
|
||||||
|
|
||||||
neo4j-graphql-js@^1.0.2:
|
neo4j-graphql-js@1.0.4:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/neo4j-graphql-js/-/neo4j-graphql-js-1.0.4.tgz#250bd44024f1505c726d2fc4ab27a35a1fc5330b"
|
resolved "https://registry.yarnpkg.com/neo4j-graphql-js/-/neo4j-graphql-js-1.0.4.tgz#250bd44024f1505c726d2fc4ab27a35a1fc5330b"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user