Field permissions: Couldn't find type Permission in any of the schemas

prisma

#1

Hi I have just gotten to give error and have no Idea what is wrong here are my codes any solution is appreciated thanks.

throw new Error("Field " + node.name.value + “: Couldn’t find type " + nodeTypeName + " in any of the schemas.”);

Error: Field permissions: Couldn’t find type Permission in any of the schemas.

This is my schema.graphql file

type Mutation {
  createItem(title: String, description: String, price: Int, image: String, largeImage: String): Item!
  updateItem(id: ID!, title: String, description: String, price: Int): Item!
  deleteItem(id: ID!): Item
  signup(email: String!, password: String!, name: String!): User!
  signin(email: String!, password: String!): User!
  signout: SuccessMessage
  requestReset(email: String!): SuccessMessage
  resetPassword(resetToken: String!, password: String!, confirmPassword: String!): User!
  updatePermissions(permissions: [Permission], userId: ID!): User
}

This is my mutation js file

 async updatePermissions(parent, args, ctx, info) {
    if (!ctx.request.userId) {
      throw new Error('You must be logged in to do that!');
    }
    const currentUser = await ctx.db.query.user(
      {
        where: {
          id: ctx.request.userId,
        },
      },
      info
    );
    hasPermission(currentUser, ['ADMIN', 'PERMISSIONUPDATE']);
    return ctx.db.mutation.updateUser(
      {
        data: {
          permissions: {
            set: args.permissions,
          },
        },
        where: {
          id: args.userId,
        },
      },
      info
    );
  },

#3

@Ezzatulla

Have you defined a Permission enum? If so can you please paste it here


#4

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.