I’m sure I’ve missed something in the docs, but have not been able to work out how to create a new SDL file to return some information that is not specifically about a model from the Prisma schema.
I’ve worked around it for now by creating a new type and query in an existing SDL, but would love to know what I have missed.
If context helps, I’ve a schema that defines various things about equipment hire, and want to create an endpoint that will summarise total revenues by day/week/month
I want to be able query graphQL for something like totalsForDate
I tried generating a SessionTotals SDL, but the cli complains there is no model for that in the schema.
So I tried manually creating an SDL with a type and a query, but it didn’t get added to graphQL types (I tried regenerating them with rw g types as well)
You can do this without using the generator tool by just creating a new file ./graphql folder.
I am not sure if there is a generator command for making one automatically that is not attached to a model that exists unfortunately. Although this is something I would like as well.
I am also new to Redwood so someone may answer with a better answer
Thanks, I tried that, I must have missed something when I did it though. This is also how it is suggested to approach calling a 3rd party API here: Using a Third Party API | RedwoodJS Docs
I’ll have another look later.
On reflection I decided that having it as part of the existing SDL is not that bad anyway, since it does use the same models
Hi @mfosker there has been some discussion about how to support just an sdl generator but besides simple adding an empty file with the gql statement there’s no real way of knowing what to put in that file. Hence the cure t way is to create the file yourself.