Delete Note

πŸ‘¨β€πŸ’Ό Great! Now admins can delete other user's notes. This will be useful for moderation purposes.
πŸ¦‰ Adding a permissions model to an application requires quite a bit of extra work in the app code. It's possible you could build in this permissions model into the prisma client via prisma client extensions which would drastically simplify the amount of work necessary. For example, you could do something like this:
export function action(request) {
	const client = prisma.$extend(getUserPrisma(request))
}
And then the client would honor the permissions. If you're interested in building this out, please give it a shot and let us know how it goes!
That said, there are some handy utilities we can make to make this easier. We'll get to those in the next step.
πŸ§β€β™‚οΈ I'm going to make a couple utilities for working with permissions and we'll have you use those in the next step. I'm also going to add an /admin route which will just be a placeholder we'll build out later.
Feel free to check my work if you're curious.

Access Denied

You must login or register for the workshop to view the diff.

Check out this video to see how the diff tab works.