♻️(summary) refactor tasks signature and make transcription tz-aware

The tasks endpoint used non-timezone-aware date and time values and split
them into separate variables, which is unconventional. Refactor the
implementation to use timezone-aware datetime objects and align transcription
formatting with the user-declared timezone. Update the source of truth for
recording start time to FileInfo.started_at for improved precision. Adjust
the task signature in preparation for upcoming user assignment work, which
will require `started_at`, `ended_at`, and `metadata_filename`.
This commit is contained in:
leo
2026-05-06 18:14:10 +02:00
committed by aleb_the_flash
parent 4c5b6de8f3
commit a695758da4
8 changed files with 156 additions and 65 deletions
+11 -9
View File
@@ -19,14 +19,14 @@ class TestTasks:
headers={"Authorization": "Bearer test-api-token"},
json={
"owner_id": "owner-123",
"filename": "recording.mp4",
"recording_filename": "recording.mp4",
"metadata_filename": "metadata.json",
"email": "user@example.com",
"sub": "sub-123",
"room": "room-abc",
"recording_date": "2026-01-01",
"recording_time": "10:00:00",
"owner_timezone": "UTC",
"language": None,
"download_link": "http://example.com/file.mp4",
"download_link": "https://example.com/file.mp4",
},
)
@@ -36,16 +36,18 @@ class TestTasks:
args = mock_apply_async.call_args.kwargs["args"]
assert args == [
"owner-123", # owner_id
"recording.mp4", # filename
"recording.mp4", # recording_filename
"metadata.json", # metadata_filename
"user@example.com", # email
"sub-123", # sub
1735725600.0, # frozen time
1735725600.0, # received_at
"room-abc", # room
"2026-01-01", # recording_date
"10:00:00", # recording_time
"UTC", # owner_timezone
None, # language
"http://example.com/file.mp4", # download_link
"https://example.com/file.mp4", # download_link
None, # context_language
None, # recording_start_at
None, # recording_end_at
]
def test_create_task_invalid_language(self, client):