Fixed login and schema

This commit is contained in:
Grzegorz Leoniec 2019-01-07 17:30:54 +01:00
parent 30d4318d17
commit 77e77229b9
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
2 changed files with 4 additions and 3 deletions

View File

@ -98,11 +98,12 @@ export const resolvers = {
const session = driver.session()
return session.run(
'MATCH (user:User {email: $userEmail}) ' +
'RETURN user {.id, .slug, .name, .avatar, .locationId, .about, .email, .password, .role} as user LIMIT 1', { userEmail: email })
'RETURN user {.id, .slug, .name, .avatar, .locationName, .about, .email, .password, .role} as user LIMIT 1', {
userEmail: email
})
.then(async (result) => {
session.close()
const [currentUser] = await result.records.map(function (record) {
console.log(record.get('user'))
return record.get('user')
})
if (currentUser && await bcrypt.compareSync(password, currentUser.password)) {

View File

@ -13,7 +13,7 @@ type LoggedInUser {
avatar:String!
email: String!
role: String!
locationId: String
locationName: String
about: String
token: String!
}