Sefaria / Sefaria-Project

New Interfaces for Jewish Texts
https://www.sefaria.org
654 stars 268 forks source link

New post #1998

Open YishaiGlasner opened 1 month ago

YishaiGlasner commented 1 month ago

Description

Use celery for posting tasks. New view for posting a whoe version object, and chnging post_link to work with celery.

Code Changes

urls.py, views.py - new post_versons and change post_link tracker.py - new function for saving a whole version object tasks.py - all functions for celery tasks history_change.py - dataclasses for celery functions util.py - celeryResponse local_settings_example.py - add var for not using celery locally

Notes

  1. new post_versions have 2 methods: Post - completely replaces the current version with the posted one (or for new version). Patch - replaces only the attributes that in the postev object excpet 'chapter'. replaces the content of every JAggedArrayNode that in the 'chapter' attribute.
  2. celery will work only for API requests and only when the local settings have CELERY_ENABLED True.
  3. when working with elery the response will have status code 202. the data will have object with checking_task_id (the task that will inform that all the other tasks were completed) and list of tasks_id.