Hi everyone! I connected prisma to an existing db ...
# random
j
Hi everyone! I connected prisma to an existing db which I have readonly permissions. The generated `schema.prisma`contains 20+ models. To implement a graphql endpoint (with apollo-server), do I have to create all the types and queries and mutations manually? Is there any tool to generate graphql files from
schema.prisma
so I can modify with?
l
The nexus-prisma tools should be able to do some or all of this for you (although I'm not sure of the exact state of that software at the moment)
c
j
@Lars Ivar Igesund @Chris Baucom Thanks!❤️ Both seem great! I‘ll go with typegraphql since it's more straightforward to me.
b
I’m using typegraphql with prisma and while compilation times are quite big, the API itself is a joy to use from the frontend
c
I’m wondering if one of you all might be able to help me with something related to typegraphql. Does anyone know how to override a mutation with a custom resolver?
For example, in my prisma schema I want to have a
slug
field that gets generated (with no spaces/all lowercase) when a new post is created based on the
title
. How can you make a custom resolver to do so?
l
@Chris Baucom I know how to do this in Nexus, but it seems typegraphql provides this via the CustomResolver feature, described down on the README (the page you get if you click the package link above)
c
@Lars Ivar Igesund Oh nice, yes I should have just kept reading down below…looks like I can use
@FieldResolver
to add
slug
in my case. I’ll have to try it out later tonight. Thanks!
👍 1