Simple questions about modularity
Hi, I am re-structuring my code and I wanted to ask if it makes sense to put al lot off common prisma queries within function, e.g. in a simple getBalance function where I need the account data, I could make an accountService and make the code a bit cleaner in my eyes.
Does this makes sense, it's my first big project, and I want to do some best practices cause the code needs to be adaptable with the future in mind.
I would appreciate any quick feedback on this from someone more experienced!
2 Replies
Hi @Jeroen_v_g
It's a good idea to group common Prisma queries in service functions. Since you're using Nestjs, you can also inject services into controllers instead of using static methods like you're doing. For example:
In the controller, you can then do something like:
Thank you!
I have builded a whole game, without using classes x)
was only possible by using prisme though I think