Add lightweight summary endpoint for task statistics

- Add GET /api/residences/summary/ endpoint
- Returns task statistics without full residence data
- Enables efficient refresh of home screen summary counts

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-03 09:52:37 -06:00
parent 61cba2519f
commit 77c8c4fad8
3 changed files with 49 additions and 0 deletions

View File

@@ -56,6 +56,20 @@ func (h *ResidenceHandler) GetMyResidences(c *gin.Context) {
c.JSON(http.StatusOK, response)
}
// GetSummary handles GET /api/residences/summary/
// Returns just the task statistics summary without full residence data
func (h *ResidenceHandler) GetSummary(c *gin.Context) {
user := c.MustGet(middleware.AuthUserKey).(*models.User)
summary, err := h.residenceService.GetSummary(user.ID)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, summary)
}
// GetResidence handles GET /api/residences/:id/
func (h *ResidenceHandler) GetResidence(c *gin.Context) {
user := c.MustGet(middleware.AuthUserKey).(*models.User)