Clarity needed on Phoenix 1.3 contexts and schema in controllers

It’s looks nice. I assume that context is keeps proper level of isolation between controller and repo & schemas. It would be logicall to hide informations about structures inside context function calls:

changeset = Billing.change_invoice(id, params)
# and it would call
Invoice.changeset(invoice_struct, params)
# where invoice_struct is
Repo.get!(Invoice, id)

Keeping this information about Invoice is redundant for controller - I already wants to change invoice, so I only wants to deal with these kind of structures.

3 Likes