5

I need to get data depends on computed field For example

const resolvers = {
  Query: {
    users: (parent, args, ctx, info) => {
      const fragment = `fragment EnsureFullName on User { firstName lastName }`
      return ctx.db.query.users({}, addFragmentToInfo(info, fragment))
    },
  },
  User: {
    fullName: parent => `${parent.firstName} ${parent.lastName}`,
  },
}

I need to get all data where fullname = 'any value',

How can I do that ?

Ghyath Darwish
  • 2,614
  • 4
  • 15
  • 31

1 Answers1

1

You need to filter manually after fetching from the database or use use a where condition to check if firstName and lastName:

const users = await prisma.users({ where: { firstName: 'any', lastName: 'value' } });
realAlexBarge
  • 1,808
  • 12
  • 19