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
Scot2y ago
Why not one api layer for both?
chnmrn.
chnmrn.OP2y ago
both different must be separated different table
Scot
Scot2y ago
Different schemas?
paxol
paxol2y 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.
chnmrn.OP2y ago
how to increase the stock back when u delete invoice,is it impossible because my stock has different purchase price
Scot
Scot2y ago
I mean it’s not impossible Maybe a diagram would help
chnmrn.
chnmrn.OP2y ago
thx man ,alr solved im use history table to undo
Want results from more Discord servers?
Add your server