Add per-residence overdue_count to API response
Adds overdueCount field to each residence in my-residences endpoint, enabling the mobile app to show pulsing icons on individual residence cards that have overdue tasks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,16 @@ func (s *ResidenceService) GetMyResidences(userID uint) (*responses.MyResidences
|
||||
summary.TasksDueNextWeek = stats.TasksDueNextWeek
|
||||
summary.TasksDueNextMonth = stats.TasksDueNextMonth
|
||||
}
|
||||
|
||||
// Get per-residence overdue counts
|
||||
overdueCounts, err := s.taskRepo.GetOverdueCountByResidence(residenceIDs)
|
||||
if err == nil && overdueCounts != nil {
|
||||
for i := range residenceResponses {
|
||||
if count, ok := overdueCounts[residenceResponses[i].ID]; ok {
|
||||
residenceResponses[i].OverdueCount = count
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &responses.MyResidencesResponse{
|
||||
|
||||
Reference in New Issue
Block a user