Answer the question
In order to leave comments, you need to log in
How to properly design such an application?
Application for ordering food. Buyers buy food together. To do this, we combine them into groups. To place an order, the buyer's browser sends a POST /orders request with the required information (cart, etc). Next, the system adds it to the orders table and assigns it the "in progress" status. In the process, it means that the system is looking for a suitable group for him, does not find it - creates a new one for him. After the post request, the browser starts periodically updating /orders/{id} to update the information about the order. As soon as she finds or creates a group, information about the group begins to be sent to him in response - the price per each, the executor of the order, the status of the order. Here I have a big question - there is an order status, and there is a group status. The order status is required before assigning a group - "group not found", "group found", "in progress" And so on. And there is the status of the group - the executor of the order has left, the order has been canceled by the executor, the order has been completed, etc. What should I do? Foreach to update the order status when the group changes for each order, or create a separate group status and order status?
Answer the question
In order to leave comments, you need to log in
An order and a group are generally different entities, or is a group like a collection of orders with common properties? If the first - we store all states separately, if the second - then most likely these are the same order statuses, because what is the difference between "group not found" and "order executor left"? IMHO both refer to the order....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question