Accessing/changing another entity when performing a db action
I'm new to NodeJS, prisma and the likes and am having some trouble implementing an action. When I create a Student, they need to get a number assigned to them. If there are already 10 students in the class, the next created student should get number 11. I'm not sure how to best do this.
I tried calling the getClass query from the createStudent action and passing the cotext along, but it is not of the correct type.
Should I send along the classId from the frontend, even though the frontend does not need to know about it? Should I just use the prismaClient and the full context over the wasp context?
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
W
Wasp
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.