tb/main #1

Open
terrabytten wants to merge 17 commits from tb/main into main
2 changed files with 7 additions and 2 deletions
Showing only changes of commit 57dce10097 - Show all commits

View file

@ -10,8 +10,11 @@ func (application *Application) bindRoutes() {
router.GET("/", application.TestHandler) router.GET("/", application.TestHandler)
router.GET("/claims/:system/:barcode", application.GetClaimsHandler) claims := router.Group("/claims/:system/:barcode")
router.POST("/claims/:system/:barcode", application.PostClaimHandler) {
claims.GET("", application.GetClaimsHandler)
claims.POST("", application.PostClaimHandler)
}
router.Run("localhost:8080") router.Run("localhost:8080")
} }

View file

@ -6,6 +6,8 @@ import (
"vegan-barcode/internal/models" "vegan-barcode/internal/models"
) )
// GetClaims doesn't automatically create a new product because maybe the user mistyped.
// Only create a new product when they want to add claims.
func (a *Application) GetClaims(system string, barcode string) (*models.ProductClaims, error) { func (a *Application) GetClaims(system string, barcode string) (*models.ProductClaims, error) {
product, err := a.db.FindProductByBarcode(system, barcode) product, err := a.db.FindProductByBarcode(system, barcode)
if err != nil { if err != nil {