Include TotalSummary in CRUD responses to eliminate redundant API calls
Backend changes: - Add WithSummaryResponse wrappers for Task, TaskCompletion, and Residence CRUD - Update services to return summary with all mutations (create, update, delete) - Update handlers to pass through new response types - Add getSummaryForUser helper for fetching summary in CRUD operations - Wire ResidenceService into TaskService for summary access - Add summary field to JoinResidenceResponse This optimization eliminates the need for a separate getSummary() call after every task/residence mutation, reducing network calls from 2 to 1. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -96,9 +96,10 @@ func SetupRouter(deps *Dependencies) *gin.Engine {
|
||||
documentService := services.NewDocumentService(documentRepo, residenceRepo)
|
||||
notificationService := services.NewNotificationService(notificationRepo, deps.PushClient)
|
||||
|
||||
// Wire up notification and email services to task service (for task completion notifications)
|
||||
// Wire up notification, email, and residence services to task service
|
||||
taskService.SetNotificationService(notificationService)
|
||||
taskService.SetEmailService(deps.EmailService)
|
||||
taskService.SetResidenceService(residenceService) // For including TotalSummary in CRUD responses
|
||||
subscriptionService := services.NewSubscriptionService(subscriptionRepo, residenceRepo, taskRepo, contractorRepo, documentRepo)
|
||||
taskTemplateService := services.NewTaskTemplateService(taskTemplateRepo)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user