Task #3033
Updated by jortel@redhat.com almost 7 years ago
Add Publication API endpoint to support listing and deleting publications. The URL should be nested under the publisher. Publications are immutable but can be deleted when not referenced by a Distribution. This will be enforced by the integrity constraints.
Use Cases:
* As a user, I want to create a publication.
> * The POST to publisher/<id>/publications/ will trigger a publish which will create a publication and return 202 and a task href.
> * On completion, the Task.created_resources will contain the created publication (unless the publisher fails).
> * The Publication.name attribute may be specified by the user in the POST document.
* As a user, I want to list publications created by a publisher to support:
> * Knowing what publications have been created.
> * Manually update a Distribution. (manual promotion).
> * Identify publications to be deleted.
* As a user, I want to delete publications:
> * A Specific publication. URL something like: "../publishers/<id>/publications/<id>/"
The Distribution FK to Publication is currently on_delete=SET_NULL but thinking we should probably change it to on_delete=PROTECT to ensure that an _active_ publication isn't ruined by mistake.
In the future, _one-time_ publisher options will be stored on the Publication.
A new _CreatedResources_ model:
* task
* resource (Generic FK)
The Task serializer will include the Task._created_resources_.
The publish task will create the Publication as defined by the POST document and passed to the plugin Publisher.publish(). On success, the created publication is added to CreatedResources. This should all be done in a single DB transaction to ensure that broken publications are not saved to the DB.