Closed alimi closed 4 years ago
Heh, we did this before stuff was better described in https://github.com/mountetna/magma/issues/164 and https://github.com/mountetna/magma/issues/165 😆. I think we came to same conclusions.
Pretty much exactly what I imagined. It seems there is as of yet no base Magma::Action
type class (is that the right name?), I guess it will show up later.
As a sanity check I might verify that this thing refuses to change the attribute name and type.
Otherwise... can this just be merged? o_O
If everyone is agreeable, I think we should merge in this PR. It sets up a decent foundation for us to build off of, and we can avoid having a long running PR 😄
Sure, let's merge to have a solid footing.
This PR adds a /update_model API endpoint per #131. So far it supports updating an attribute's options.
The endpoint is backed by the newly added
UpdateModelController
. It will iterate over the array of actions it receives, and defer to action classes to perform those actions. For example, anupdate_attribute
action will be performed byMagma::UpdateAttribute
.In addition to performing actions, each action class is responsible for validating its action params. This division of responsibilities will help keep
UpdateModelController
pretty stable as we add new actions. It will also make it easier for us to parallelize the work going forward.We've also restricted the endpoint to superusers based on conversations we've had in the past. We can change the permissions if something else makes sense.