in api.go [131:151]
func (h apiHandlers) getProductCustomers(c *gin.Context) {
id, err := strconv.Atoi(c.Param("id"))
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
limit := 1000
if countString := c.Param("count"); countString != "" {
limit, err = strconv.Atoi(countString)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
}
customers, err := getProductCustomers(c.Request.Context(), h.db, id, limit)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.JSON(http.StatusOK, customers)
}