nexus-plugin-prisma icon indicating copy to clipboard operation
nexus-plugin-prisma copied to clipboard

Filter on computed fields?

Open iherger opened this issue 5 years ago • 4 comments

Is it possible to filter on computed fields?

It seems that nexus / nexus-prisma does not generate types for computed fields, but I may be missing

I have defined a computed field for my User model as follows:

    t.string('searchField', {
      resolve: (parent, _, __) =>
        parent.firstname.toLowerCase() +
        ' ' +
        parent.familyname.toLowerCase() +
        ' ' +
        parent.email.toLowerCase(),
    });

My user query is defined as:

    t.crud.users({ ordering: true, filtering: true });

I am getting the error

Field "searchField" is not defined by type QueryFindManyUserWhereInput.

iherger avatar Sep 25 '19 09:09 iherger

This would be great!

arvindell avatar Nov 20 '20 00:11 arvindell

I have the same question and haven't found anything about it yet.

Sayeck avatar Dec 09 '20 13:12 Sayeck

Is there any way to do this?

mojtabaesl avatar Jan 08 '21 00:01 mojtabaesl

Also curious about this, would be very handy.

bstro avatar Apr 06 '21 02:04 bstro