paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
681 stars 55 forks source link

prisma-select issue for custom output path #210

Closed manarjan closed 3 years ago

manarjan commented 3 years ago

I am getting the below error when I try to use

const select = new PrismaSelect(info).value;

[Nest] 65877 - 17/05/2021, 16:45:13 [ExceptionsHandler] Cannot find module '.prisma/client'

My PrismaClient is in a custom path rather than the default, as I am using a monorepo for multiple microservices.

generator client {
    provider      = "prisma-client-js"
    binaryTargets = ["native", "darwin"]
    output        = "../src/.generated/prisma/client"
}

Is there a way to point PrismaSelect to the correct Client?

AhmedElywa commented 3 years ago

Import {Prisma} from "../generate/client"

and

const select = new PrismaSelect(info, {dmmf:Prisma.dmmf}).value;

https://paljs.com/plugins/select#constructor

manarjan commented 3 years ago

@AhmedElywa thanks for the quick response.

I was able to make it work, although with a slight modification.

const select = new PrismaSelect(info, { dmmf: [Prisma.dmmf] }).value;

had to pass the dmmf in an array.