Layered architecture decision
if i have 2 api items and invoice:
the invoice api will reduce the items quantity
is it better to make it on
-make decrease quantity from items repo and import it to invoice service layer
-same but import to invoice repo layer
-make it on invoice repo layer because it relate on invoice
7 Replies
Why not one api layer for both?
both different must be separated
different table
Different schemas?
I would call ItemRepo.decrease from invoice service layer, the "decrease item quantity when invoice things happen" is a business logic rule, so keep it outside of the repository
how to increase the stock back when u delete invoice,is it impossible
because my stock has different purchase price
I mean it’s not impossible
Maybe a diagram would help
thx man ,alr solved im use history table to undo