in api.go [191:209]
func (h apiHandlers) getCustomerDetails(c *gin.Context) {
id, err := strconv.Atoi(c.Param("id"))
if err != nil {
err := errors.Wrap(err, "failed to parse customer ID")
c.AbortWithError(http.StatusInternalServerError, err)
return
}
customer, err := getCustomer(c.Request.Context(), h.db, id)
if err != nil {
err := errors.Wrap(err, "failed to get customer details")
c.AbortWithError(http.StatusInternalServerError, err)
return
}
if customer == nil {
c.AbortWithStatus(http.StatusNotFound)
return
}
c.JSON(http.StatusOK, customer)
}