refactor(backend): isolate workspace aggregation

This commit is contained in:
2026-07-21 14:58:25 +08:00
parent 14a140985c
commit a53f047efe
8 changed files with 818 additions and 734 deletions

View File

@@ -140,14 +140,13 @@ func (h *Handler) workspace(c *gin.Context) {
c.JSON(http.StatusUnauthorized, gin.H{"error": "missing current user"})
return
}
projectID, err := strconv.ParseUint(c.Param("id"), 10, 64)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid project id"})
projectIdentity, ok := httpx.IdentityParam(c, "id")
if !ok {
return
}
workspace, err := h.service.Workspace(userID, uint(projectID))
workspace, err := h.service.Workspace(userID, projectIdentity)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to load workspace"})
writeProjectError(c, err)
return
}
c.JSON(http.StatusOK, workspace)