seminars icon indicating copy to clipboard operation
seminars copied to clipboard

Update API to use pending table

Open roed314 opened this issue 4 years ago • 0 comments

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 and pending_talks with essentially the same schema as seminars and talks (they don't need a by_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.

roed314 avatar May 30 '20 21:05 roed314