updateUserReferrer mutation ready
This commit is contained in:
1 parent
6e36ca3f94
commit
53a3d3736b
2 files changed
+21
No files matched your search
@@ -6,6 +6,7 @@ const Schema = mongoose.Schema
|
||||
|
||||
const userSchema = new Schema({
|
||||
authId: String,
|
||||
referrerId: String,
|
||||
creationDate: String,
|
||||
alias: String,
|
||||
firstName: String,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user