DEV Community

Discussion on: E-commerce website - adding/deleting product from database. Part 3

Collapse
 
mcwolfmm profile image
mcwolfmm • Edited

I have a few remarks:

When working with Promise, you do not process the rejected state almost anywhere (you do not use the catch function).
Again, when working with Promise, you mix different styles then / catch (your style) and async / await (obviously from the AWS documentation). Choose one of your styles and stick to it (keep in mind that when working with await the rejected state is reduced to an exception so you have to use a try / catch block).

Generate "unique" identifiers with a random number generator. This seems to work but there is no guarantee that you will not duplicate a key. Usually such data is generated by the database that stores the records. However, for you this functionality is limited due to the choice of NoSql database. And this requires you to implement your own counters (which to use as an identifier).

Collapse
 
themodernweb profile image
Modern Web

I'll say its very good that you are pointing the mistakes so that future comers can improve the issues. πŸ™‚πŸ‘

Collapse
 
themodernweb profile image
Modern Web

Okay, i got it. I'll fix this and try to improve next timeπŸ™‚

Collapse
 
zuharabiya profile image
Zuha Rabiya Khan

@mcwolfmm Can you help us clearing this error?

Collapse
 
mcwolfmm profile image
mcwolfmm

what error is it? in my post I am not referring to an error made by the author, but I am pointing out implementation details that I do not like how they are implemented (because they can lead to an error).