Model/backlog/tasks/task-2 - Add-POST-bulk-uploads-task_id-combine-FastAPI-route.md
2026-04-20 13:06:31 +00:00

36 lines
1.1 KiB
Markdown

---
id: TASK-2
title: 'Add POST /bulk-uploads/{task_id}/combine FastAPI route'
status: To Do
assignee: []
created_date: '2026-04-20'
updated_date: '2026-04-20 11:53'
labels:
- backend
- bulk-upload
- api
dependencies: []
priority: high
ordinal: 10000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Expose HTTP route to trigger `bulk_address2uprn_combiner`:
`POST /bulk-uploads/{task_id}/combine`
Creates a new sub_task under task_id, then pushes `{task_id, sub_task_id}` to the combiner SQS queue (see `backend/bulk_address2uprn_combiner/main.py` for consumer shape).
Idempotency: if `bulk_address_uploads.combined_output_s3_uri` already set for this task, return 200 with `{already_combined: true}` (mirror current frontend behaviour).
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Route returns 202 with {task_id, sub_task_id} on new trigger
- [ ] #2 Returns 200 {already_combined: true} if combined_output_s3_uri already set
- [ ] #3 SQS message enqueued with correct shape
- [ ] #4 Queue URL from config
- [ ] #5 Auth via validate_token
<!-- AC:END -->