Add API endpoint that can be used to trigger an async job to export a database to a zip

Background

After #603 (closed) CoreHandler.export_workspace_applications should be able to generate a zip file containing the export of a single database/application.

The issue

We should add a new API endpoint following the pattern of our other async API endpoints like DuplicateApplicationJobType which:

  1. Have /async/ at the end of their path
  2. Checks the user has the permission ExportApplicationOperationType (a new one you should make and only give to Admins in default_roles.py). Separately this should also be added to backend/src/baserow/core/permission_manager.py:148 ADMIN_ONLY_OPERATIONS
  3. calls JobHandler().create_and_start_job and starts a new JobType
  4. You should implement this new JobType by subclassing it and adding it to the job_type_registry
  5. This job type should have its own Job model for storing the result (see the DuplicateApplicationJob model)
  6. You should implement a new ActionType (not the undoable base class however just literally ActionType which then. This is so this event shows up in the audit log properly.
  7. This new ActionType should call CoreHandler.export_workspace_applications and upload the resulting ZIP into the default storage with a secure name in a new sub folder just for these exports (the storage bucket can be publicly accessible so the name must be secure and non-guessable).
  8. The URL to access this zip should be saved on the model associated with your job type and returned in its response serializer for the frontend to access later.
  9. When the job is cleaned up, this file must also be deleted.
  10. The job type must have the same transaction_atomic_context as the DuplicateApplicationJobType
  11. The job type should properly pass through the progress object to the CoreHandler so the job's status is updated in realtime for you.

MR Size notes

You might want to split this into two MRs:

  1. Adds the API endpoint and all it's boilerplate, but it does nothing and responses with 200 OK
  2. Second MR that implements the JobType + ActionType
Edited by Nigel Gott