can you please show us, how you would implement checking on updating his own cart and existence of same product in user's cart. it's difficult for newbies like me. thanks in advance.
Generally, if you are using any frameworks, you can use "object" permissions. But here you can write your custom logic to check the ocndition "cart.user.id==req.user.id" and throw the error accordingly. For same product, you can make another query before adding to check if the product already exist or not. Same thing we did in changeQuantity controller can be done in addCart as well if the product already exists. Hope this helps. Let me know if you have any other confusion regarding the same.
@@evoqys bro but for identifying the product presence we have to find that product in cartItem, but the issue is coming there is that product id is not unique, so how we could solve this issue
can you please show us, how you would implement checking on updating his own cart and existence of same product in user's cart. it's difficult for newbies like me. thanks in advance.
Generally, if you are using any frameworks, you can use "object" permissions. But here you can write your custom logic to check the ocndition "cart.user.id==req.user.id" and throw the error accordingly.
For same product, you can make another query before adding to check if the product already exist or not. Same thing we did in changeQuantity controller can be done in addCart as well if the product already exists. Hope this helps. Let me know if you have any other confusion regarding the same.
@@evoqys thanks, I will give a try.
@@evoqys bro but for identifying the product presence we have to find that product in cartItem, but the issue is coming there is that product id is not unique, so how we could solve this issue
please add forgot password and account activation functionality.
thank you