pbrezina / copr / copr

Forked from copr/copr 2 years ago
Clone

9842b5e frontend, backend: minimalize the transfered amount of action information

Authored and Committed by frostyx 4 years ago
    frontend, backend: minimalize the transfered amount of action information
    
    Previously we did two things less than ideally
    
    1. Frontend sent either a priority value if it was set (e.g. in case
       that the action was deprioritized) or `None`. If the priority was
       `None` then backend tried figure out the default value for the
       action type from `DefaultActionPriorityEnum`. This was meant to
       transfer less data when the action wasn't deprioritized by the
       frontend. In fact, it didn't achieve anything but complicated the
       workflow. Instead, frontend now sends integer priority value in all
       cases and it's usage on backend is much more straightforward.
    
    2. When reading `/backend/pending-actions/` on backend, we created
       specific action type objects for each action. Which absolutely
       makes sense, but it led to unnecessarily bloating the action
       dicts returned by that view. They needed to contain `action_type`
       and `object_type` keys just so we can create an object from the
       correct class on backend and then not utilize that at all. The
       point is to transfer as less information about the actions in
       `/backend/pending-actions/` as possible and then provide everything
       through `/backend/action/<ID>` once its needed.
    
    This commit addresses both of them.