Problem
The boost endpoint needs HTTP-facing views that accept requests, validate input, and delegate heavy work to Celery tasks. Currently no views exist. The views must be thin: validate the request payload, enqueue the Celery task, and immediately return a 202 Accepted with the task ID. No service-layer logic (file I/O, Weblate API calls, translation processing) should run in the request path.
Acceptance Criteria
Implementation Notes
Use @api_view decorators or APIView subclasses from Django REST Framework. The serializer for add-or-update should validate project_slug as a slug field, repo_url as a URL, and languages as a list of ISO 639-1 codes. The Celery task signature should accept all validated fields plus the requesting user's ID (from request.user) so the worker can set up the correct Weblate user context. Keep the views module focused on HTTP concerns only — the remaining 3pt of the views+tasks+services split lands in tasks.py and services.py.
References
- Related files:
src/boost_weblate/views.py, src/boost_weblate/serializers.py (if created), src/boost_weblate/urls.py
- Depends on:
urls.py route table, tasks.py Celery task signature
Problem
The boost endpoint needs HTTP-facing views that accept requests, validate input, and delegate heavy work to Celery tasks. Currently no views exist. The views must be thin: validate the request payload, enqueue the Celery task, and immediately return a
202 Acceptedwith the task ID. No service-layer logic (file I/O, Weblate API calls, translation processing) should run in the request path.Acceptance Criteria
GET /info/returns a JSON response with module name, version, and supported capabilitiesPOST /add-or-update/accepts a JSON body with at leastproject_slug,repo_url, andlanguagesfields400with a structured error body when required fields are missing or malformedtasks.add_or_update.delay(...)and returns202 Acceptedwith{"task_id": "<uuid>"}IsAuthenticatedpermission class); unauthenticated requests return401or403request.dataaccess without checksImplementation Notes
Use
@api_viewdecorators orAPIViewsubclasses from Django REST Framework. The serializer foradd-or-updateshould validateproject_slugas a slug field,repo_urlas a URL, andlanguagesas a list of ISO 639-1 codes. The Celery task signature should accept all validated fields plus the requesting user's ID (fromrequest.user) so the worker can set up the correct Weblate user context. Keep the views module focused on HTTP concerns only — the remaining 3pt of the views+tasks+services split lands intasks.pyandservices.py.References
src/boost_weblate/views.py,src/boost_weblate/serializers.py(if created),src/boost_weblate/urls.pyurls.pyroute table,tasks.pyCelery task signature