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
Scot
Scot3y ago
Why not one api layer for both?
chnmrn
chnmrnOP3y ago
both different must be separated different table
Scot
Scot3y ago
Different schemas?
paxol
paxol3y ago
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
chnmrn
chnmrnOP3y ago
how to increase the stock back when u delete invoice,is it impossible because my stock has different purchase price
Scot
Scot3y ago
I mean it’s not impossible Maybe a diagram would help
chnmrn
chnmrnOP3y ago
thx man ,alr solved im use history table to undo

Did you find this page helpful?