tb/main #1
					 2 changed files with 7 additions and 2 deletions
				
			
		|  | @ -10,8 +10,11 @@ func (application *Application) bindRoutes() { | |||
| 
 | ||||
| 	router.GET("/", application.TestHandler) | ||||
| 
 | ||||
| 	router.GET("/claims/:system/:barcode", application.GetClaimsHandler) | ||||
| 	router.POST("/claims/:system/:barcode", application.PostClaimHandler) | ||||
| 	claims := router.Group("/claims/:system/:barcode") | ||||
| 	{ | ||||
| 		claims.GET("", application.GetClaimsHandler) | ||||
| 		claims.POST("", application.PostClaimHandler) | ||||
| 	} | ||||
| 
 | ||||
| 	router.Run("localhost:8080") | ||||
| } | ||||
|  |  | |||
|  | @ -6,6 +6,8 @@ import ( | |||
| 	"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) { | ||||
| 	product, err := a.db.FindProductByBarcode(system, barcode) | ||||
| 	if err != nil { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue