#41 Add event type and search_key to Event table. They should be used to query for particular events using the JSON API.
Merged by jkaluza. Opened by jkaluza.
jkaluza/freshmaker searchable-events  into  master

Download 41.patch

The main goal of this PR is to allow JSON API to query for events by type and by the search_key. It should be possible to do queries like this:

  • Get all the modules which have been rebuilt as dependency of module build with id 123
  • Get all the Docker images which have been rebuilt because of errata advisory RHBA-2017-123 update.
  • ...

In order to do these queries, we have to extend the Event table by Event type (so you can limit the query to just events triggered by Errata or MBS, or dist-git and so on) and add a key by which the events can be searched. The key is different per each event type. For dist-git, it is branch and commit hash, for MBS it is build ID and so on.

There is new modules.EVENT_TYPES list which gives each BaseEvent subclass database id. There is new BaseEvent.search_key property, which returns the key used for searching for every BaseEvent instance.

I'm not sure if the search_key is enough generally, but for the current events and other events I have in my mind currently it should be enough to just have single key to query on.

Hm, I have to rebase that to merge it :)

rebased

rebased

Rebased and fixed the flake8 test.

Tests are passing, merging :).

Pull-Request has been merged by jkaluza

Metadata