Skip to content

Commit 55047fa

Browse files
author
Alexander Dadyka
committed
Add: API documentation to README.md
1 parent d55ed3a commit 55047fa

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

README.md

+71
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Nginx
2222
- PHP 8.2
2323
- PHPUnit
24+
- PostgreSQL 16
2425
- Presenters
2526
- Repository Pattern (with criteria queries)
2627
- RESTful API
@@ -72,3 +73,73 @@ docker-compose exec php-fpm php artisan test --coverage
7273
```
7374
docker-compose exec php-fpm ./vendor/bin/phpunit --coverage-html ./storage/reports/coverage
7475
```
76+
77+
## API Endpoints
78+
79+
### All Orders with pagination
80+
- Request URL: `http://localhost:8081/api/orders?start=0&end=2&sort_column=id&sort_type=asc`
81+
- Method: `GET`
82+
- Path: `/orders`
83+
- Request Parameters: `start, end, sort_column, sort_type`
84+
- Status Code: `200`
85+
- Response:
86+
```json
87+
{
88+
"data": [
89+
{
90+
"id": 10000001,
91+
"agency_name": "МКК ТверьВектор",
92+
"status": "prepayment",
93+
"is_confirmed": true,
94+
"is_checked": true,
95+
"rental_date": "21-12-2023",
96+
"user_name": "Марат Романович Яковлев",
97+
"transport_count": 3,
98+
"guest_count": 3,
99+
"admin_note": "Ну, душа, вот это так!"
100+
},
101+
{
102+
"id": 10000002,
103+
"agency_name": "ЗАО КазТехРечЛизинг",
104+
"status": "waiting",
105+
"is_confirmed": true,
106+
"is_checked": true,
107+
"rental_date": "27-12-2023",
108+
"user_name": "Сергеева Эльвира Андреевна",
109+
"transport_count": 3,
110+
"guest_count": 3,
111+
"admin_note": null
112+
}
113+
]
114+
}
115+
```
116+
117+
### Create Order
118+
- Request URL: `http://localhost:8081/api/orders`
119+
- Method: `POST`
120+
- Path: `/orders`
121+
- Request Parameters: `agency_name, rental_date, guest_count, transport_count, user_name, email, phone`
122+
- Status Code: `201`
123+
- Response:
124+
```json
125+
{
126+
"data": {
127+
"id": 10000011,
128+
"agency_name": "Test Agency Name",
129+
"status": "waiting",
130+
"is_confirmed": false,
131+
"is_checked": false,
132+
"rental_date": "22-12-2023",
133+
"user_name": "Test User Name",
134+
"transport_count": 1,
135+
"guest_count": 1,
136+
"admin_note": null,
137+
"note": null,
138+
"email": "[email protected]",
139+
"phone": "71437854547",
140+
"confirmed_at": null,
141+
"created_at": "21-12-2023 12:22:33",
142+
"updated_at": "21-12-2023 12:22:33"
143+
}
144+
}
145+
```

0 commit comments

Comments
 (0)