updateUserReferrer mutation ready

This commit is contained in:
Luis Fernando Molina committed 2018-09-27 10:56:30 +02:00
1 parent 6e36ca3f94
commit 53a3d3736b
2 files changed
+21

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ const Schema = mongoose.Schema
const userSchema = new Schema({
authId: String,
referrerId: String,
creationDate: String,
alias: String,
firstName: String,
+20
View File
@@ -30,6 +30,7 @@ const UserType = new GraphQLObjectType({
fields: () => ({
id: { type: GraphQLID},
authId: { type: GraphQLString},
referrerId: {type: GraphQLString},
alias: {type: GraphQLString},
firstName: {type: GraphQLString},
middleName: {type: GraphQLString},
@@ -233,6 +234,25 @@ const Mutation = new GraphQLObjectType({
avatarChangeDate: args.avatarChangeDate
}
return User.update(key, updatedUser)
}
},
updateUserReferrer: {
type: UserType,
args: {
id: {type: new GraphQLNonNull(GraphQLID)},
referrerId: {type: GraphQLString}
},
resolve (parent, args) {
let key = {
_id: args.id,
referrerId: null
}
let updatedUser = {
referrerId: args.referrerId
}
return User.update(key, updatedUser)
}
}