Handle order of events, add soft delete and add valid_at
Part of #33 (closed)
Description
This MR adds the logic to ignore outdated events by looking at the valid_at
that will be sent with each event.
Query parameters, request body or request header
There were basically three options to send the valid_at
to the API endpoint:
- As query parameter
- In the request body
- As a request header
What is important is that it needs to play nicely with the OpenAPI specification and the OpenAPI client generator.
The first option I explored is the request body. This felt like the best option, given the fact we are already using a request body for our PUT
requests. It turned out this is not an option that's possible, because it's unsupported by spectacular:
- https://github.com/tfranzel/drf-spectacular/issues/379
- https://github.com/tfranzel/drf-spectacular/issues/431#issuecomment-862738643
It's an old discussion, but at that point it was not supported by the OpenAPI specification. It is now:
https://github.com/OAI/OpenAPI-Specification/issues/1801
But there's no way in spectacular to get that working.
The second option I explored is adding it as a query parameter. That is something spectacular and OpenAPI allows. It's fairly simple to get this working and it works quite nicely. The added benefit is also that we split account data (request body) from event logic (query parameters).
I did not explore the request header, as I felt like the query parameters are better than the request header.