diff --git a/README.md b/README.md index 3131a27..56d84a6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ `make && make run` ## Create a new car: -`curl -X POST http://localhost:8080/v1/cars -d '{"data" : {"type" : "cars" , "attributes": {"brand" : "bmw", "model": "x5", "price": 999, "status": "OnTheWay"}}}'` +`curl -X POST http://localhost:8080/v1/cars -d '{"data" : {"type" : "cars" , "attributes": {"brand" : "bmw", "model": "x5", "price": 999, "status": "OnTheWay", "mileage": 0}}}'` ## List cars: `curl -X GET http://localhost:8080/v1/cars` diff --git a/internal/model/model_car.go b/internal/model/model_car.go index 3f90c87..075bd25 100644 --- a/internal/model/model_car.go +++ b/internal/model/model_car.go @@ -10,11 +10,12 @@ import ( ) type Car struct { - ID string `json:"-"` - Brand string `json:"brand"` - Model string `json:"model"` - Price uint64 `json:"price"` - Status string `json:"status"` // OnTheWay, InStock, Sold, Discontinued + ID string `json:"-"` + Brand string `json:"brand"` + Model string `json:"model"` + Price uint64 `json:"price"` + Status string `json:"status"` // OnTheWay, InStock, Sold, Discontinued + Mileage int64 `json:"mileage"` // I suppose it should be made unsigned, but that's what the task says ¯\_(ツ)_/¯ } func (c Car) Verify() (bool, api2go.HTTPError) {