add mileage field

idk why but i missed it
This commit is contained in:
GenZmeY 2021-03-20 23:40:18 +03:00
parent 58752d513f
commit 6142ac93b9
2 changed files with 7 additions and 6 deletions

View File

@ -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`

View File

@ -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) {