Friends, prisma makes it a lot easier to create an application by generating types based on my models. But is it possible to get classes of these models from somewhere? To conveniently create the necessary model instances
d
Dick Fickling
01/21/2021, 10:45 PM
typegraphql-prisma gives you classes/instances, but it's still not ActiveRecord so you won't see
.save()
methods or anything like that
j
JY
01/22/2021, 2:58 AM
Prisma generates types instead of classes/interfaces so what I do is create a model class that implements my Prisma model type.
When querying I then use `class-transformer`’s
plainToClass()
method to convert the raw Prisma results into my model class.