-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.go
More file actions
30 lines (25 loc) · 859 Bytes
/
Copy pathmodels.go
File metadata and controls
30 lines (25 loc) · 859 Bytes
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
package main
import "time"
// TaskStatus represents where a task is in its lifecycle.
type TaskStatus string
const (
StatusPending TaskStatus = "pending"
StatusProcessing TaskStatus = "processing"
StatusDone TaskStatus = "done"
StatusFailed TaskStatus = "failed"
)
// Task is the core unit of work moving through the system.
// JSON tags control how this looks when serialized to API responses.
type Task struct {
ID string `json:"id"`
Payload string `json:"payload"`
Status TaskStatus `json:"status"`
Result string `json:"result,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// CreateTaskRequest is what the client sends in the POST body.
type CreateTaskRequest struct {
Payload string `json:"payload"`
}