In my nestjs application, I have two roles: admin and user. A normal user is only allowed to access, create, update, and delete the 'post' they created (post.creator = userId). Whereas the admin must be able to access and delete all posts.
Should i create two different controller group @Controller("admin/post") and @Controller("/post") for admin and normal users respectively?
eg api/admin/post route for admin and api/post route for normal user
OR,
should i use a same route for both user? and do access validation
If i do this in case of normal user when editing and deleting posts, dont i have to make one db call to check the access and then another one to update the data?
whereas if i use different route for normal user i could just db.post.delete({_id: <postId>, creator: <userId>}) (single db call)