If I were building a real ecom site, I wouldn't want to have carts removed from db when users clear them. I'd want to keep that data to track what/why users were clearing. Rather, I'd want the "clear cart" action to set cart status to "cleared" or something like that. When/if they add again, I'd create a new cart for them.
Perhaps I want to create a cart for each user immediately, even if empty... Unsure.
If I were building a real ecom site, I wouldn't want to have carts removed from db when users clear them. I'd want to keep that data to track what/why users were clearing. Rather, I'd want the "clear cart" action to set cart status to "cleared" or something like that. When/if they add again, I'd create a new cart for them.
Perhaps I want to create a cart for each user immediately, even if empty... Unsure.
https://github.com/Nostromos/what.ecom/blob/d2d0c9710add85d6a3c3170bd644b1925e82829d/backend/routes/CartRouter.js#L44