guardian/frontend — pull request #2644 by janua (2014-01-02 15:14:31+00:00)
Title: Refactor facia tool api

This PR contains the refactoring I have been wanting to do for awhile, and no better time than this quiet week! I think I have gotten nearly everything I wanted to refactor in terms of the `Facia Tool Api`.

The changes are as follows:
- Remove `/admin` endpoint.
- Split publishing and discarding of drafts into their own endpoints. Before they shared the same endpoint themselves and also shared with the updating of a collection.
- Remove `JsonExtract`
- Remove the case classes `BlockActionJson`, `UpdateTrailblockJson` and `UpdateTrailblockConfigJson`. These were mainly needed in the past to distinguish between publishing and discarding drafts, setting `metadata` such as `max`, `min`, and `displayName`. We have moved to a more singular JSON format now, where `itemMeta`, a `Map[String, JsValue]`, can support any new data we need.
- The above two things allow us to remove `JsonShape`.
- Refactor of `UpdateActions` trait; mainly into a more functional style with small methods composed together through `Option.map`.
- The actual `FaciaApi` used to read and write to a database now uses (again) `Option` to represent failure and success.
- Archiving now works slightly differently, where before, the latest `collection.json` in history was the thing before what currently exists in the current `collection.json`. Now the latest `collection.json` == latest `collection.json` in history.