add create product endpoint
This commit is contained in:
parent
43c183c29a
commit
561b8841fc
7 changed files with 104 additions and 23 deletions
|
@ -2,12 +2,13 @@ package application
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"vegan-barcode/internal/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (a *Application) GetClaimsHandler(c *gin.Context) {
|
||||
system := c.DefaultQuery("system", "upc")
|
||||
system := c.Query("system")
|
||||
barcode := c.Query("barcode")
|
||||
|
||||
productClaims, err := a.GetClaims(system, barcode)
|
||||
|
@ -17,3 +18,13 @@ func (a *Application) GetClaimsHandler(c *gin.Context) {
|
|||
}
|
||||
c.JSON(http.StatusOK, productClaims)
|
||||
}
|
||||
|
||||
func (a *Application) PostClaimHandler(c *gin.Context) {
|
||||
system := c.Query("system")
|
||||
barcode := c.Query("barcode")
|
||||
|
||||
var requestBody models.UserClaimForm
|
||||
c.BindJSON(&requestBody)
|
||||
|
||||
a.CreateClaim(system, barcode, requestBody)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue