mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
5473db9be1
* fix(downloads): separate list items from task details * fix(downloads): scope task list to downloader * fix(downloads): stabilize table data
22 lines
556 B
TypeScript
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,
|
|
}
|
|
}
|