Implement opal-task Phase 1: Database foundation
- Add SQLite database with schema for tasks, tags, and working_set - Implement config management with Viper (opal.yml) - Create Task struct with proper types (*time.Time, Priority int) - Add database migration system - Implement recurrence pattern parsing (1d, 1w, 1m, 1y) - Setup project structure with cmd/ and internal/engine/ - Add dependencies: sqlite3, uuid, cobra, viper, color
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Status byte
|
||||
|
||||
const (
|
||||
StatusPending Status = 'P'
|
||||
StatusCompleted Status = 'C'
|
||||
StatusDeleted Status = 'D'
|
||||
StatusRecurring Status = 'R'
|
||||
)
|
||||
|
||||
type Priority int
|
||||
|
||||
const (
|
||||
PriorityLow Priority = 0
|
||||
PriorityDefault Priority = 1
|
||||
PriorityMedium Priority = 2
|
||||
PriorityHigh Priority = 3
|
||||
)
|
||||
|
||||
type Task struct {
|
||||
// Identity
|
||||
UUID uuid.UUID
|
||||
ID int
|
||||
|
||||
// Core fields
|
||||
Status Status
|
||||
Description string
|
||||
Project *string
|
||||
Priority Priority
|
||||
|
||||
// Timestamps
|
||||
Created time.Time
|
||||
Modified time.Time
|
||||
Start *time.Time
|
||||
End *time.Time
|
||||
Due *time.Time
|
||||
Scheduled *time.Time
|
||||
Wait *time.Time
|
||||
Until *time.Time
|
||||
|
||||
// Recurrence (parent-child approach)
|
||||
RecurrenceDuration *time.Duration
|
||||
ParentUUID *uuid.UUID
|
||||
|
||||
// Derived fields (not stored in DB)
|
||||
Tags []string
|
||||
}
|
||||
|
||||
// timeNow returns current time (allows mocking in tests)
|
||||
var timeNow = time.Now
|
||||
Reference in New Issue
Block a user