Closed marcjulian closed 4 years ago
https://github.com/fivethree-team/nestjs-prisma-starter/tree/prisma2 work in progress
prisma/seed.ts:1:10 - error TS2614: Module '".../node_modules/@generated/photon"' has no exported member 'Photon'. Did you mean to use 'import Photon from ".../node_modules/@generated/photon"' instead?
1 import { Photon } from '@generated/photon';
Fixed by using default imports: import Photon from '@generated/photon';
@hegelstad which version of prisma2 are you using? Since prisma2 preview-12 the import of Photon has change see here https://github.com/prisma/prisma2/releases/tag/2.0.0-preview-12
I followed the steps in the readme, so I suppose npm install -g prisma2 doesn't install the latest preview?
Yes it should install the latest prisma2 preview, you can check the version with prisma2 -v
When creating a new model you need to add it to schema.prisma AND inside src/models right ?
Yes you have to add a new model to prisma/schema.prisma
model Movie {
id String
...
}
Then you create a model in src/models/movie.ts
like
@ObjectType()
export class User {
@Field()
id: string;
// Add properties here, add @Field() to properties which should be exposed in the API
// Add properties without @Field() which are private (such as Password and other sensitive informations)
}
You can learn more about prisma models in there docs https://github.com/prisma/prisma2#readme. Also I recommend checking out Nestjs documentation and type-graphql
I'd love to see an example of how you might integrate Nexus!
@Jayphen I tried out using Nexus with nestjs and prisma1. You can find an example here https://github.com/marcjulian/nestjs-prisma-nexus. I have stopped using nexus with nestjs since type-graphql has better nestjs support. There is also an integration planned for prisma2 https://github.com/MichalLytek/type-graphql/issues/476
Thanks for the links. I tried last night to get it working with prisma2 and got most of the way, but with some issues. I'll stick to type-graphql for now!
Replacing Prisma with Prisma2 https://github.com/prisma/prisma2#readme