Giter Site home page Giter Site logo

Prisma Integration about nestjs-query HOT 5 OPEN

rulim34 avatar rulim34 commented on May 29, 2024 1
Prisma Integration

from nestjs-query.

Comments (5)

darr1s avatar darr1s commented on May 29, 2024 1

I've been spending on time on this topic, currently using nestjs-prisma-generator instead. In my past experience, creating an abstract for prisma its rather hard because the generated types from the client is particular to the schema, and there isn't a low-level generic exposed.

There is multiple issues/community thread in prisma are tracking this as well. All end up using some form of generator to read prisma schema and generate boilerplate code instead.

from nestjs-query.

TriPSs avatar TriPSs commented on May 29, 2024

Could be interesting to add! But to much work for myself as I also don't use / have a project using Prisma.

from nestjs-query.

dvins avatar dvins commented on May 29, 2024

We were willing to tackle building a Prisma adapter for Nestjs-Query so deeply looked into this. The bottom line is that it's just not possible with Prisma as it stands. The generated code does not emit the metadata needed at runtime in order to enable such an adapter. We ended up rolling a Prisma code generator to generate TypeORM definitions based on our Prisma schema. It wasn't pretty, but it saves us from having to write hundreds of entity classes and keeps up with ongoing changes a lot easier.

from nestjs-query.

TriPSs avatar TriPSs commented on May 29, 2024

Interesting @dvins, I myself now also started using Prisma in a project and wonder: would something basic not work if we only go based on the metadata nestjs-query itself collects for relations?

I think the non relations should not be an issue right? Since you would already need to decorate each field.

We could also, if more info is needed expose @Field/@FilterableField ect from the Prisma adapter package so we can add additional fields the adapter could handle it correctly.

from nestjs-query.

dvins avatar dvins commented on May 29, 2024

I've been spending on time on this topic, currently using nestjs-prisma-generator instead. In my past experience, creating an abstract for prisma its rather hard because the generated types from the client is particular to the schema, and there isn't a low-level generic exposed.

There is multiple issues/community thread in prisma are tracking this as well. All end up using some form of generator to read prisma schema and generate boilerplate code instead.

Spot on, the metadata (outside of the Prisma schema) just does not exist to do this.

from nestjs-query.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.