Does anyone know of a github project that nicely d...
# orm-help
j
Does anyone know of a github project that nicely demonstrates a "enterprise" level Prisma app? Something large enough to warrant some level of organisation into modules or domains.
m
Id also be interested in something like this... All the examples are rather basic and only a starting point.
n
Hey you two 👋 you might have seen these already but there are two public example projects that represent great real world use cases: • https://github.com/poulainv/tottem • https://github.com/2color/real-world-grading-app If you’ve seen these projects already, what exactly are you missing from them? 🙂 Otherwise, do you have any specific questions about using Prisma in an “enterprise” context?
j
Thanks! The first one is more enterprisy. Just a bit old (using the depricated nexusPrismaPlugin)
My immediate research is about how to organise my .graphql files with graphql-code-generator, i'm thinking to have a directory for each domain/module of my app, and also prefix each document name within there to also match
m
@nikolasburk I am looking for a case where I can see how row level access in the db is handled. My current point of view is just add an enum to every row permission (isSuperUser, isUser) something like that and handle it with the prisma query where permission = isSuperUser. Or is there a "better way"? 🙂
thanks1
n
i’m thinking to have a directory for each domain/module of my app
@James I think this approach generally makes sense! When you speak of organising
.graphql
files with
graphql-code-generator
, do you mean on the frontend or on the backend by the way?
My current point of view is just add an enum to every row permission (isSuperUser, isUser) something like that and handle it with the prisma query where permission = isSuperUser.
@manuel that sounds fine to me if you want to handle this on the application layer. If you’re using PostgreSQL, you could still look into row-level access control on the DB layer as well. While this can’t be natively represented in the Prisma schema, you can always customize the migration files generated by Prisma Migrate with some dedicated SQL to achieve your goal here 🙂
j
on the frontend
If you had 2 different pages of your webapp both showing some user details, but they differ slightly (eg one has their SignUpDate, the other doesnt)... would you have 2 .graphql documents for these? Or would you do it some other way? Fragments? Or
@include(if:
?
m
@nikolasburk thanks!
@James I would do one
.graphql
and just show what you need.
j
one file - that would be slightly overfetching for 1 of the site pages though
m
if you think this 0.5kb will make a difference do two...
if you have a grapqhl client with cache it will look it up in the cache and then do a refetch in the background anyway...
j
thank you