prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

Is it possible to use the generated types with rest api ?

Open MohannadBahaa opened this issue 4 years ago • 1 comments
trafficstars

something like below:

import { FindManyUserArgs , User } from 'prisma/@generated/prisma-nestjs-graphql';
import { PrismaService } from './prisma.service'

// just an example 
  @Get('users')
  async getAllUsers(@Query() query: FindManyUserArgs): Promise<User[]> {
    return this.prismaService.user.findMany(query);
  }

MohannadBahaa avatar Nov 09 '21 08:11 MohannadBahaa

It was not designed for that. But people are saying that they adopted it somehow, probably with some modification of result generated classes.

unlight avatar Nov 09 '21 17:11 unlight