Add performance optimizations and database indexes
Database Indexes (migrations 006-009): - Add case-insensitive indexes for auth lookups (email, username) - Add composite indexes for task kanban queries - Add indexes for notification, document, and completion queries - Add unique index for active share codes - Remove redundant idx_share_code_active and idx_notification_user_sent Repository Optimizations: - Add FindResidenceIDsByUser() lightweight method (IDs only, no preloads) - Optimize GetResidenceUsers() with single UNION query (was 2 queries) - Optimize kanban completion preloads to minimal columns (id, task_id, completed_at) Service Optimizations: - Remove Category/Priority/Frequency preloads from task queries - Remove summary calculations from CRUD responses (client calculates) - Use lightweight FindResidenceIDsByUser() instead of full FindByUser() These changes reduce database load and response times for common operations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -100,8 +100,10 @@ func TestTaskHandler_CreateTask(t *testing.T) {
|
||||
|
||||
taskData := response["data"].(map[string]interface{})
|
||||
assert.Equal(t, "Install new lights", taskData["title"])
|
||||
assert.NotNil(t, taskData["category"])
|
||||
assert.NotNil(t, taskData["priority"])
|
||||
// Note: Category and Priority are no longer preloaded for performance
|
||||
// Client resolves from cache using category_id and priority_id
|
||||
assert.NotNil(t, taskData["category_id"], "category_id should be set")
|
||||
assert.NotNil(t, taskData["priority_id"], "priority_id should be set")
|
||||
assert.Equal(t, "150.5", taskData["estimated_cost"]) // Decimal serializes as string
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user