package endpoints import ( "github.com/gin-gonic/gin" "relynolli-server/models" "relynolli-server/services" "strconv" ) func (h *handlers) GetCartItems(c *gin.Context) { fuserId := c.Query("fuserId") if fuserId == "" { c.JSON(400, models.Response{Status: 400, Info: "\"fuserId\" should be provided"}) return } idx, err := strconv.Atoi(fuserId) if err != nil { c.JSON(400, models.Response{Status: 400, Info: "\"fuserId should be an integer number\""}) return } c.JSON(200, services.GetCartItems(idx)) } func (h *handlers) CreateFUser(c *gin.Context) { lastInsertId := services.CreateFuser() c.JSON(201, gin.H{ "fuserId": lastInsertId, }) }