- Register Competitor + CompetitorQuote in AllModels() - Add TaskTypeCompetitorImport task type constant - CountUsage now checks pricelist_id, warehouse_pricelist_id, competitor_pricelist_id - WebHandler: load competitors.html template, add Competitors() page handler Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package tasks
|
|
|
|
import "time"
|
|
|
|
// TaskStatus represents the current status of a task
|
|
type TaskStatus string
|
|
|
|
const (
|
|
TaskStatusRunning TaskStatus = "running"
|
|
TaskStatusCompleted TaskStatus = "completed"
|
|
TaskStatusError TaskStatus = "error"
|
|
)
|
|
|
|
// TaskType represents the type of background task
|
|
type TaskType string
|
|
|
|
const (
|
|
TaskTypeRecalculate TaskType = "recalculate"
|
|
TaskTypeStockImport TaskType = "stock_import"
|
|
TaskTypePricelistCreate TaskType = "pricelist_create"
|
|
TaskTypePartnumberBookCreate TaskType = "partnumber_book_create"
|
|
TaskTypeCompetitorImport TaskType = "competitor_import"
|
|
)
|
|
|
|
// Task represents a background task with progress tracking
|
|
type Task struct {
|
|
ID string `json:"id"`
|
|
Type TaskType `json:"type"`
|
|
Status TaskStatus `json:"status"`
|
|
Progress int `json:"progress"` // 0-100
|
|
Message string `json:"message"`
|
|
Result map[string]interface{} `json:"result,omitempty"`
|
|
Error string `json:"error,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
DoneAt *time.Time `json:"done_at,omitempty"`
|
|
}
|