From 6142ac93b9c94466975d948fccfff1f7b380e47a Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sat, 20 Mar 2021 23:40:18 +0300 Subject: [PATCH] add mileage field idk why but i missed it --- README.md | 2 +- internal/model/model_car.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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) {