Replace status_id with in_progress boolean field
- Remove task_statuses lookup table and StatusID foreign key - Add InProgress boolean field to Task model - Add database migration (005_replace_status_with_in_progress) - Update all handlers, services, and repositories - Update admin frontend to display in_progress as checkbox/boolean - Remove Task Statuses tab from admin lookups page - Update tests to use InProgress instead of StatusID - Task categorization now uses InProgress for kanban column assignment 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -35,20 +35,6 @@ func (TaskPriority) TableName() string {
|
||||
return "task_taskpriority"
|
||||
}
|
||||
|
||||
// TaskStatus represents the task_taskstatus table
|
||||
type TaskStatus struct {
|
||||
BaseModel
|
||||
Name string `gorm:"column:name;size:20;not null" json:"name"`
|
||||
Description string `gorm:"column:description;type:text" json:"description"`
|
||||
Color string `gorm:"column:color;size:7" json:"color"`
|
||||
DisplayOrder int `gorm:"column:display_order;default:0" json:"display_order"`
|
||||
}
|
||||
|
||||
// TableName returns the table name for GORM
|
||||
func (TaskStatus) TableName() string {
|
||||
return "task_taskstatus"
|
||||
}
|
||||
|
||||
// TaskFrequency represents the task_taskfrequency table
|
||||
type TaskFrequency struct {
|
||||
BaseModel
|
||||
@@ -79,11 +65,12 @@ type Task struct {
|
||||
Category *TaskCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
||||
PriorityID *uint `gorm:"column:priority_id;index" json:"priority_id"`
|
||||
Priority *TaskPriority `gorm:"foreignKey:PriorityID" json:"priority,omitempty"`
|
||||
StatusID *uint `gorm:"column:status_id;index" json:"status_id"`
|
||||
Status *TaskStatus `gorm:"foreignKey:StatusID" json:"status,omitempty"`
|
||||
FrequencyID *uint `gorm:"column:frequency_id;index" json:"frequency_id"`
|
||||
Frequency *TaskFrequency `gorm:"foreignKey:FrequencyID" json:"frequency,omitempty"`
|
||||
|
||||
// In Progress flag - replaces status lookup
|
||||
InProgress bool `gorm:"column:in_progress;default:false;index" json:"in_progress"`
|
||||
|
||||
DueDate *time.Time `gorm:"column:due_date;type:date;index" json:"due_date"`
|
||||
NextDueDate *time.Time `gorm:"column:next_due_date;type:date;index" json:"next_due_date"` // For recurring tasks, updated after each completion
|
||||
EstimatedCost *decimal.Decimal `gorm:"column:estimated_cost;type:decimal(10,2)" json:"estimated_cost"`
|
||||
|
||||
@@ -24,11 +24,6 @@ func TestTaskPriority_TableName(t *testing.T) {
|
||||
assert.Equal(t, "task_taskpriority", p.TableName())
|
||||
}
|
||||
|
||||
func TestTaskStatus_TableName(t *testing.T) {
|
||||
s := TaskStatus{}
|
||||
assert.Equal(t, "task_taskstatus", s.TableName())
|
||||
}
|
||||
|
||||
func TestTaskFrequency_TableName(t *testing.T) {
|
||||
f := TaskFrequency{}
|
||||
assert.Equal(t, "task_taskfrequency", f.TableName())
|
||||
@@ -134,28 +129,6 @@ func TestTaskPriority_JSONSerialization(t *testing.T) {
|
||||
assert.Equal(t, "#e74c3c", result["color"])
|
||||
}
|
||||
|
||||
func TestTaskStatus_JSONSerialization(t *testing.T) {
|
||||
status := TaskStatus{
|
||||
Name: "In Progress",
|
||||
Description: "Task is being worked on",
|
||||
Color: "#3498db",
|
||||
DisplayOrder: 2,
|
||||
}
|
||||
status.ID = 2
|
||||
|
||||
data, err := json.Marshal(status)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var result map[string]interface{}
|
||||
err = json.Unmarshal(data, &result)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, float64(2), result["id"])
|
||||
assert.Equal(t, "In Progress", result["name"])
|
||||
assert.Equal(t, "Task is being worked on", result["description"])
|
||||
assert.Equal(t, "#3498db", result["color"])
|
||||
}
|
||||
|
||||
func TestTaskFrequency_JSONSerialization(t *testing.T) {
|
||||
days := 7
|
||||
freq := TaskFrequency{
|
||||
|
||||
Reference in New Issue
Block a user