seminars
seminars copied to clipboard
Update API to use pending table
Currently, the API inserts rows into the talks
and seminars
tables that are not supposed to be displayed (they have display=False
and by_api=True
). This makes some code awkward.
Instead, here's a different model.
- Create new tables,
pending_seminars
andpending_talks
with essentially the same schema asseminars
andtalks
(they don't need aby_api
) - When the API makes a change, it writes to this table. Rows in this table can be incomplete (for example, all columns might be
NULL
except the speaker column, where a change is being made). There is no versioning in this table: there is one row per talk or series. - When you create a seminar or talk object, you can also pass in a row of this table. It will apply the changes described therein.
- It makes it easy to see which columns are changing for a user to approve.
- There is a new API route to approve pending changes and merge them into the live table. This route is only available for users that have gotten approval (we believe that they've tested their code and are protecting their token appropriately).
- We will add a rate limit in the user table: when this limit reaches a certain threshold, we check how many changes were made today and start rejecting if too many.
- Add checkboxes to the approval page so that users can approve only a subset of the changes.