Open dthyresson opened 3 years ago
@dthyresson Thoughts on this one now that it's been a while? Think it's still worthwhile? Can queue back up for discussion
@dthyresson @jtoar Just taking a look back at the beginning of the issues list and thought this would be interesting to implement if it is still something we would find useful.
Current CRUD generation support fetching a unique record of the model by its id.
There may be times where it is useful to
findFirst
such that Prisma does not throw an exception if not found -- or you have multiple matching records and need just one.https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/crud#findfirst
Perhaps:
By adding this and showcasing it in the generator, perhaps more developers would opt to use that versus a
findMany
with and order and a take of 1 ... or worse: using the existingfindMany()
option and returning the first array indexed item at [0].Open for discussion to see if helpful to have added.