How can I connect to the user on Apollo Server?

Viewed 29

I am a student practicing GraphQL. I want to manage the money list for each user.

I tried to create money list connected with the user, but the playground result value coming out null. I don't know where I wrong.

export default {
  Mutation: {
    createMoney: async (_, { title, amount, date }, { loggedInUser }) => {
      await client.moneyList.create({
        data: {
          title,
          amount,
          date,

          User: {
            connect: {
              id: loggedInUser.id,
            },
          },
        },
      });
      return {
        ok: true,
        error,
      };
    },
  },
};

enter image description here

this is my prisma studio T.T

1 Answers

It was an issue that came out because the resolver file name was wrong.

Related