Skip to content

Commit b2276e2

Browse files
committed
Fix builds
1 parent 43f2c64 commit b2276e2

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

config/testVariables.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,17 @@ module.exports = {
4747
}
4848
email
4949
phone
50+
info {
51+
about {
52+
shortDescription
53+
designation
54+
}
55+
}
5056
isAdmin
5157
isModerator
58+
isBlocked
59+
isRemoved
60+
token
5261
}}`,
5362
})
5463
.set("Accept", "application/json");
@@ -62,10 +71,23 @@ module.exports = {
6271
email: "abc${userNo}@email.com"
6372
password: "password"
6473
) {
74+
_id
6575
name {
6676
firstName
6777
lastName
6878
}
79+
email
80+
phone
81+
info {
82+
about {
83+
shortDescription
84+
designation
85+
}
86+
}
87+
isAdmin
88+
isModerator
89+
isBlocked
90+
isRemoved
6991
token
7092
} }`,
7193
})

graphql/resolvers/auth.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const {
1010
module.exports = {
1111
login: async (args) => {
1212
try {
13-
const user = await User.findOne({ email: args.email });
13+
const user = await User.findOne({ email: args.email }).lean();
1414
if (!user) {
1515
throw new Error(noUserError);
1616
}
@@ -20,7 +20,7 @@ module.exports = {
2020
}
2121
const token = jwt.sign(
2222
{
23-
id: user.id,
23+
id: user._id,
2424
name: user.name,
2525
},
2626
`${process.env.JWT_SECRET}`,
@@ -30,8 +30,7 @@ module.exports = {
3030
}
3131
);
3232
return {
33-
_id: user._id,
34-
name: user.name,
33+
...user,
3534
token: token,
3635
};
3736
} catch (err) {

graphql/resolvers/organization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = {
4545
};
4646
}
4747
return {
48-
organization,
48+
...organization,
4949
exists: true,
5050
};
5151
} catch (err) {

graphql/schema/user.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ input userFindInput {
7676
type authData {
7777
_id: String!
7878
name: userName!
79+
email: String!
80+
phone: String
81+
socialMedia: userSocialMedia
82+
info: userInfo!
83+
isFirstAdmin: Boolean!
84+
isAdmin: Boolean!
85+
isModerator: Boolean!
86+
isBlocked: Boolean!
87+
isRemoved: Boolean!
7988
token: String!
8089
}
8190
`;

0 commit comments

Comments
 (0)