Files
zpan/shared/download-task.ts
Jasper Van 5473db9be1 fix(downloads): separate list data from task details (#525)
* fix(downloads): separate list items from task details

* fix(downloads): scope task list to downloader

* fix(downloads): stabilize table data
2026-07-27 10:22:47 -04:00

22 lines
556 B
TypeScript

import type { DownloadTask, DownloadTaskListItem } from './schemas/downloads'
export function toDownloadTaskListItem(task: DownloadTask): DownloadTaskListItem {
const runtime = task.status.runtime
return {
id: task.id,
spec: task.spec,
status: {
state: task.status.state,
progress: task.status.progress,
runtime: runtime
? {
phase: runtime.phase,
etaSeconds: runtime.etaSeconds,
torrent: runtime.torrent,
}
: null,
},
createdAt: task.createdAt,
}
}