Closed frederikhors closed 3 years ago
Hey @frederikhors!
As I mentioned in the previous discussion, I don't like the idea of calling another service for all missing details. It creates coupling between the services, and you could leak too much domain knowledge, so watch out for it.
Or maybe I can change API and get that data from client (e.g.: Tax instead of taxID).
I think you could consider this, but there are some complexities as well. I'd try to get only what's needed for the invoice. And watch out for the language boundaries. You now pass a customer
, which probably has many details your invoice doesn't need. The invoice should need only a "buyer" information that includes address and tax details.
Not sure what's in PaymentType
and Tax
, do you store these in a database?
Not sure what's in PaymentType and Tax, do you store these in a database?
Yes, my head is still DB-oriented unfortunately.
THANKS!
Prologue
Let's say I'm creating a simple invoice.
I'm using specific types for Invoice creation (directly from API port):
Then in my `app/command/invoice_create.go:
Question
As you can see I'm getting from clients only the ID of
customer
,paymentType
,tax
, and so on...But I use those structs value for my
NewInvoice
func.Now I can fetch those values from repo using methods like yours:
in
updateFn
I can get each of them and only after I can useNewInvoice()
.Or maybe I can change API and get that data from client (e.g.:
Tax
instead oftaxID
).And maybe this is also a business doubt because maybe those ID references must be present and correct (in DB) at creation and not taken by the client itself or maybe not.
What do you think of how I am progressing? Do you have any other ideas?
Where am I doing wrong?