notiz-dev / nestjs-prisma

Easy Prisma support for your NestJS application
https://nestjs-prisma.dev
MIT License
587 stars 50 forks source link

Extensions: `create` and `update` broken #76

Closed adamnyberg closed 1 year ago

adamnyberg commented 1 year ago

Hey,

Maybe it is something wrongly configured on my system but when I try to use the methods create and update, typescript can not compile the project.

Steps to reproduce:

  1. Fork this repo.
  2. Add the following method to the AppService in examples/extentions/src/app.service.ts
    createUser(data: { email: string; name?: string }) {
    return this.prismaService.client.user.create(data);
    }
  3. Run npm run build

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Am I using the this.prismaService.client.user.create wrong?

marcjulian commented 1 year ago

Hi @adamnyberg you need to pass data as an object property to the user.create, read more about create Create a single record with Prisma Client

createUser(data: { email: string; name?: string }) {
 return this.prismaService.client.user.create({ data });
}