Extract constants instead of duplicating literals

This commit is contained in:
Pijus Kamandulis
2025-05-14 20:01:46 +03:00
parent 7e0c10479b
commit e20a6ca7cd
9 changed files with 87 additions and 72 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/pikami/cosmium/internal/constants"
"github.com/pikami/cosmium/internal/datastore"
"github.com/pikami/cosmium/internal/resourceid"
)
@@ -42,9 +43,9 @@ func (h *Handlers) GetPartitionKeyRanges(c *gin.Context) {
}
if status == datastore.StatusNotFound {
c.IndentedJSON(http.StatusNotFound, gin.H{"message": "NotFound"})
c.IndentedJSON(http.StatusNotFound, constants.NotFoundResponse)
return
}
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": "Unknown error"})
c.IndentedJSON(http.StatusInternalServerError, constants.UnknownErrorResponse)
}