Nexus-plugin-prisma: prisma2 support for react-admin

Created on 27 Mar 2020  路  3Comments  路  Source: graphql-nexus/nexus-plugin-prisma

https://github.com/marmelab/react-admin is an absolute awesome tool for creating admin interfaces and we already managed to use it for prisma1, which is a blast.

unfortunatly, there is no working data-provider for prisma2. Some attempts were made (https://github.com/dnhsoft/ra-data-prisma2, which is a fork of @Weakky 's https://github.com/Weakky/ra-data-opencrud), but no one is working right now.

Main problem seems that nexus-prisma does not provide the old Connection queries, altough pagination is supported in prisma2.

it seems that this type is only used in counts:

 gqlTypes.field(gqlTypes.name(`${queryType.name}Connection`), {
            alias: gqlTypes.name('total'),
            arguments: countArgs,
            selectionSet: gqlTypes.selectionSet([
              gqlTypes.field(gqlTypes.name('aggregate'), {
                selectionSet: gqlTypes.selectionSet([
                  gqlTypes.field(gqlTypes.name('count'))
                ])
              })
            ])
          })

so it might be a first step, if nexus-prisma would support a count api out of the box

Most helpful comment

by the way i have a working data-provider and will publish it as an npm package soon

All 3 comments

by the way i have a working data-provider and will publish it as an npm package soon

so we released a version of a react-admin data provider for prisma2! https://github.com/panter/ra-data-prisma

we currently use count without args, but i try now to get count args to work

the package has been updated to work with latest prisma and nexus-prisma (also supports count properly)

Was this page helpful?
0 / 5 - 0 ratings