Remove embedded completions from task response

Since completions are fetched separately via GetCompletionsByTask,
there's no need to embed them in the task JSON response.

- Remove Completions field from TaskResponse (keep CompletionCount)
- Remove Completions.CompletedBy preloads from task queries

This reduces response payload size and improves query performance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-28 08:50:50 -06:00
parent f02c1e6a64
commit b38a1f547b
2 changed files with 3 additions and 12 deletions

View File

@@ -31,7 +31,6 @@ func (r *TaskRepository) FindByID(id uint) (*models.Task, error) {
Preload("Status").
Preload("Frequency").
Preload("Completions").
Preload("Completions.CompletedBy").
First(&task, id).Error
if err != nil {
return nil, err
@@ -136,7 +135,6 @@ func (r *TaskRepository) GetKanbanData(residenceID uint, daysThreshold int) (*mo
Preload("Status").
Preload("Frequency").
Preload("Completions").
Preload("Completions.CompletedBy").
Where("residence_id = ? AND is_archived = ?", residenceID, false).
Order("due_date ASC NULLS LAST, priority_id DESC, created_at DESC").
Find(&tasks).Error
@@ -261,7 +259,6 @@ func (r *TaskRepository) GetKanbanDataForMultipleResidences(residenceIDs []uint,
Preload("Status").
Preload("Frequency").
Preload("Completions").
Preload("Completions.CompletedBy").
Preload("Residence").
Where("residence_id IN ? AND is_archived = ?", residenceIDs, false).
Order("due_date ASC NULLS LAST, priority_id DESC, created_at DESC").