adding required fields

This commit is contained in:
sammyoina
2020-06-19 21:28:22 +03:00
parent e440b0ef7b
commit b7ab41be8a
2 changed files with 104 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
# uber4freefood
## Food Api
###### Running
Clone files into go src directory
run `docker-compose up`
###### port `*:8080`
###### Api Routes
`GET /food`
This return all the records from the table
```
{
"data": [
{
"id": 1,
"foodName": "",
"dietType": "",
"description": "",
"specialIngridients": "",
"serving": "",
"SpecialNote": "",
"foodImageId": "",
"locationLat": "",
"locationLong": "",
"status": ""
}
]
}
```
`POST /food`
This is used to create a record
```
{
"data": [
{
"foodName": "",
"dietType": "",
"description": "",
"specialIngridients": "",
"serving": "",
"SpecialNote": "",
"foodImageId": "",
"locationLat": "",
"locationLong": "",
"status": ""
}
]
}
```
`GET /food/:id`
return specific record from given id
```
{
"data": [
{
"foodName": "",
"dietType": "",
"description": "",
"specialIngridients": "",
"serving": "",
"SpecialNote": "",
"foodImageId": "",
"locationLat": "",
"locationLong": "",
"status": ""
}
]
}
```
PATCH /food/:id
Edit staus for food
`{"Status": ""}`
returns
```
{
"data": [
{
"id": 1,
"foodName": "",
"dietType": "",
"description": "",
"specialIngridients": "",
"serving": "",
"SpecialNote": "",
"foodImageId": "",
"locationLat": "",
"locationLong": "",
"status": ""
}
]
}
```
`DELETE /food/:id`
delete specified record
```
{
"data": true
}
```
+2
View File
@@ -14,6 +14,8 @@ type Food struct {
LocationLat string `json:"locationLat"`
LocationLong string `json:"locationLong"`
Status string `json:"status"`
AngelUserID string `json:"angelUserID"`
humanUserID string `json:"humanUserID"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time