Question on domain model and microflow for a Product-Retailer app

Hi all, This is a simple application aiming to list cat food product details for end-users. I have created a list of the retailers and the products each with 4 data entered for testing. Just like in real life, not all retailers have all the products are available in stock. Therefore, I would like to add a switch where I can be able to enable products on stock with the switch-button in the Retailers list, where I can later add a list view to the Product list that shows the details of the retailers that have the product instock. I know this has to be worked with Microflow but I have no idea what to build in the flow and what attributes to be added to the ‘Instock’ entity to make the goal happen.   The following is my domain model and the interface I have in hand. Much thanks in advance. I am using the web-modeller as I am a Mac-user. 
2 answers


As I understand from you question; you want to set if the product is on stock for a specific retailer. And thus, the product details aren't added by the individual Retailer, but by the head office of the retailers. Right? This means that each retailer has its own OnStock Object.

Your domain model should look like this

If above assumption is correct, then you should change the context of your list. Based on my example domain model, instead of showing the list of products, you should show a list of the Stock objects of that Retailer. Thus for each product there should be a Stock object for each Retailer.  Not depending if the product is on stock or not. Any situation. To identify if a product is on stock, you switch the boolean Available to true and false if not. This is simple when you have the context of your list set to stock, referencing the current Retailer. Because each stock object refers to a single Product. 


Hi Rene, thank you for the answer. It might be a very good alternative solution for my issue.

However, my thoughts are more like having the administrator of the application who is authorized to amend the data of Products and Retailers separately. 

For, the ‘Retailer’ list, where only the administrator can access it, has a “register product to be in stock” button (demonstrated in the first photo on the above post). By clicking it, the administrator will be guided to a list view of ‘Products’ where he can press the switch button to register a product to be in stock for this particular retailer (demonstrated in the second photo on the above post).

Also, I have created a second list view that shows all attributes of ‘Product’ for general users, where there is a ‘details’ button for this. By clicking on it, general users will be guided to a form where they can see all the attributes of a ‘Product’. Here, in this form, I hope the association of  ‘Product’, ‘Stock’, and ‘Retailer’ can show me all the attributes of the ‘Retailer’ that ‘register product to be instock’.

Below is a flow to explain my idea:

Administrator access ‘Retailer’ list > click ‘register product instock’ > enable switch > General user access ‘Product’ list > click ‘details’ > see attributes of ‘Retailer’ that Administrator help ‘register product instock’

Apologies for typing that many words, hope that you can understand my idea :)