Twaha-Rahman/e-commercify

[REQUEST] Add storage info, such as SKU, quantity, size, weight etc

Closed this issue · 9 comments

Is your feature request related to a problem? Please describe.
I think store owners would have a problem keeping track of stock and where the ordered items are located inside their warehouse.

Describe the solution you would like
I think we should add a subschema with storage info. Either that or insert it directly into the product schema.

Describe alternatives you have considered

  1. Subschema
  2. Product schema
    A subschema is a fancy way of adding objects into objects without a lot of mess.

I think each product should have an id and that id will be used to create a new document (inside the management collection) that will have all the required info for keeping track of stock and where the ordered items are located inside their warehouse.

But why would we take the product ID and put it in a totally different collection when we could insert and query a subschema, like the discounts?

But why would we take the product ID and put it in a totally different collection when we could insert and query a subschema, like the discounts?

Unlike the discounts, these infos aren't meant to be received by the shopper. These infos are going to be consumed by the management part of the website. Thus, I was saying it would be a good idea to have some separation of concerns.

It is possible to hide information unless specifically queried. It's often used with user info so that only the necessary information is transferred
https://mongoosejs.com/docs/api/query.html#query_Query-select

Hmmm...seems interesting. But this might make each product object much large. Other than that this looks promising.

Keep in mind that 10k products take up less than half the maximum size of a single object. IE each object could probably be 100k or a million items before hitting the limit

Ok then. We can go with the subschema approach.

@magnus195 Can you please do a PR to update the Docs with the specific fields?

After the product model is finished we need to think about users too, but I guess that would be easier