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