fixed bug with new user not being created on comp feed post

This commit is contained in:
Sendou
2020-04-18 02:13:35 +03:00
parent 2a4dcbdba3
commit 0fb2069301

View File

@@ -36,13 +36,11 @@ const typeDef = gql`
const resolvers = {
Mutation: {
addCompetitiveFeedEvent: async (root, args, ctx) => {
console.log("args", args)
if (args.lohiToken !== process.env.LOHI_TOKEN) {
throw new UserInputError("Invalid token provided")
}
console.log("jaa")
const user = await User.find({ discord_id: args.poster_discord_id })
const user = await User.findOne({ discord_id: args.poster_discord_id })
if (!user) {
const newUser = new User({
discord_id: ctx.poster_discord_id,