Prisma 1 Forum

I keep getting this message “…must have a selection of subfields. Did you mean…”

Not sure what I’m doing incorrectly.
Keep getting these two errors:

[GraphQL error]: Message: Field "groups" of type "[Group!]" must have a selection of subfields. Did you mean "groups { ... }"?, Location: [object Object], Path: undefined

[GraphQL error]: Message: Cannot query field "permission" on type "User". Did you mean "permissions"?, Location: [object Object], Path: undefined

Here are my two types:

type User {
	 id: ID! @id 
	 first_Name: String!
	 last_Name: String!
	 email: String! @unique
	 password: String!
	 resetToken: String
	 resetTokenExpiry: Float
     createdGroups: [Group!] @relation(name: "CreatedGroupsByUser")
	 groups: [Group!] @relation(name: "GroupsByUser")
	 createdAt: DateTime
	 user_violations: Int
	 permissions: [Permission] @scalarList(strategy: RELATION)

type Group {
  id: ID! @id
  title: String
  author: User! @relation(name: "CreatedGroupsByUser")
  members: [User] @relation(name: "GroupsByUser")
  draw_amount: Int!
  createdAt: DateTime

Here is my mutation to create a group and attach the user that created the group to that specific group
(it isn’t working but i think it should be something like this )

  async createGroup(parent, args, ctx, info) {
	    const group = await ctx.db.mutation.createGroup(
	        data: {
    return group;

prisma-generated types look like:

type Mutation {
  createUser(data: UserCreateInput!): User!
  createGroup(data: GroupCreateInput!): Group!
  updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User
  updateGroup(data: GroupUpdateInput!, where: GroupWhereUniqueInput!): Group
  deleteUser(where: UserWhereUniqueInput!): User
  deleteGroup(where: GroupWhereUniqueInput!): Group
  upsertUser(where: UserWhereUniqueInput!, create: UserCreateInput!, update: UserUpdateInput!): User!

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