Model/backlog/tasks/task-1 - Add-POST-bulk-uploads-trigger-splitter-FastAPI-route.md
2026-04-20 13:06:31 +00:00

38 lines
1.3 KiB
Markdown

---
id: TASK-1
title: Add POST /bulk-uploads/trigger-splitter FastAPI route
status: Done
assignee: []
created_date: '2026-04-20'
updated_date: '2026-04-20 12:31'
labels:
- backend
- bulk-upload
- api
dependencies: []
priority: high
ordinal: 2000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Expose an HTTP route that the frontend can call instead of sending SQS directly. Route:
`POST /bulk-uploads/trigger-splitter`
Body: `{task_id, sub_task_id, s3_uri}` — task+subtask already created by frontend `/api/tasks` call before this is invoked.
Behaviour: validate inputs, then publish an SQS message to the postcode_splitter queue (see `backend/postcode_splitter/main.py` for expected message shape: `{task_id, sub_task_id, s3_uri}`). Use existing SubTaskInterface / TasksInterface patterns from `backend/app/tasks/router.py`.
Place under `backend/app/` next to `tasks/router.py` — likely `backend/app/bulk_uploads/router.py`.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Route returns 202 with {task_id, sub_task_id}
- [ ] #2 SQS message enqueued with correct shape for postcode_splitter Lambda
- [ ] #3 Auth via existing `validate_token` dependency
- [ ] #4 Queue URL from config, not hardcoded
- [ ] #5 Unit test with mocked boto3 sqs client
<!-- AC:END -->