File size: 793 Bytes
8820bb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package models

import "time"

type TaskType string

const (
	TaskTypeDownload TaskType = "download"
	TaskTypeExtract  TaskType = "extract"
)

type TaskStatus string

const (
	TaskStatusQueued  TaskStatus = "queued"
	TaskStatusRunning TaskStatus = "running"
	TaskStatusSuccess TaskStatus = "success"
	TaskStatusFailed  TaskStatus = "failed"
)

type Task struct {
	ID         uint       `json:"id" gorm:"primaryKey"`
	Type       TaskType   `json:"type"`
	Status     TaskStatus `json:"status"`
	Source     string     `json:"source"`
	TargetPath string     `json:"targetPath"`
	Progress   int        `json:"progress"`
	Logs       string     `json:"logs" gorm:"type:text"`
	Error      string     `json:"error"`
	CreatedAt  time.Time  `json:"createdAt"`
	UpdatedAt  time.Time  `json:"updatedAt"`
}