first commit

This commit is contained in:
2026-02-18 19:54:52 +07:00
commit 8e070562cb
101 changed files with 13462 additions and 0 deletions

322
docs/task.md Normal file
View File

@@ -0,0 +1,322 @@
## Создание задачи
```http
POST /api/tasks
Content-Type: application/json
Accept: application/json****
```
Запрос
```bash
curl -X POST "http://localhost:8000/api/tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"title": "Tenetur earum.",
"is_done": false,
"due_at": "2026-02-18T15:00:00Z",
"tags": ["work", "backend"]
}'
```
Ответ
```json
{
"data": {
"id": 26,
"title": "Tenetur earum.",
"is_done": false,
"due_at": "2026-02-18T15:00:00.000000Z",
"created_at": "2026-02-18T12:23:26.000000Z",
"updated_at": "2026-02-18T12:23:26.000000Z",
"tags": [
{
"id": 16,
"name": "work"
},
{
"id": 17,
"name": "backend"
}
]
}
}
```
### Возможные ошибки
#### 422 Unprocessable Entity
| Поле | Ошибка | Пример ответа |
|-----------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `title` | Обязательное поле | `{"message":"The title field is required.","errors":{"title":["The title field is required."]}}` |
| `title` | Максимум 200 символов | `{"message":"The title field must not be greater than 200 characters.","errors":{"title":["The title field must not be greater than 200 characters."]}}` |
| `due_at` | Неверный формат даты | `{"message": "The due at field must match the format Y-m-d\\TH:i:s\\Z.","errors":{"due_at":["The due at field must match the format Y-m-d\\TH:i:s\\Z."]}}` |
| `due_at` | Некорректная дата | `{"message":"The due at field must be a valid date. (and 1 more error)","errors":{"due_at":["The due at field must be a valid date.","The due at field must match the format Y-m-d\\TH:i:s\\Z."]}}` |
| `tags` | Не массив | `{"message":"The tags field must be an array.","errors":{"tags":["The tags field must be an array."]}}` |
| `tags.*` | Максимум 50 символов | `{"message":"The tags.0 field must not be greater than 50 characters.","errors":{"tags.0":["The tags.0 field must not be greater than 50 characters."]}}` |
| `is_done` | Не boolean | `{"message":"The is done field must be true or false.","errors":{"is_done":["The is done field must be true or false."]}}` |
## Получение списка задач
### Запрос
```http
GET /api/tasks
Accept: application/json
```
### Параметры запроса
| Параметр | Тип | Обязательный | Описание |
|----------|---------|--------------|-------------------------------------------------------------|
| q | string | нет | Поиск по названию задачи длина 200 символов |
| is_done | boolean | нет | Фильтр по статусу выполнения |
| tag | string | нет | Фильтр по тегу длина 50 символов |
| sort | string | нет | Допустимые значения: created_at, due_at |
| order | string | нет | Направление сортировки. Допустимые значения: asc, desc |
| page | integer | нет | Номер страницы |
| per_page | integer | нет | Количество элементов на странице. Min: 1, Max: 50 см конфиг |
Пример
```bash
curl -X GET "http://localhost:8000/api/tasks?q=Tenetur" \
-H "Accept: application/json"
```
Ответ
```json
{
"data": [
{
"id": 18,
"title": "Tenetur aspernatur ipsa.",
"is_done": false,
"due_at": null,
"created_at": "2026-02-18T12:06:06.000000Z",
"updated_at": "2026-02-18T12:06:06.000000Z",
"tags": [
{
"id": 9,
"name": "animi"
},
{
"id": 13,
"name": "dolorum"
}
]
},
{
"id": 19,
"title": "Tenetur earum.",
"is_done": false,
"due_at": null,
"created_at": "2026-02-18T12:06:06.000000Z",
"updated_at": "2026-02-18T12:06:06.000000Z",
"tags": [
{
"id": 7,
"name": "itaque"
},
{
"id": 12,
"name": "perferendis"
}
]
},
{
"id": 26,
"title": "Tenetur earum.",
"is_done": false,
"due_at": "2026-02-18T15:00:00.000000Z",
"created_at": "2026-02-18T12:23:26.000000Z",
"updated_at": "2026-02-18T12:23:26.000000Z",
"tags": [
{
"id": 16,
"name": "work"
},
{
"id": 17,
"name": "backend"
}
]
}
],
"links": {
"first": "http://localhost:8000/api/tasks?page=1",
"last": "http://localhost:8000/api/tasks?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"page": null,
"active": false
},
{
"url": "http://localhost:8000/api/tasks?page=1",
"label": "1",
"page": 1,
"active": true
},
{
"url": null,
"label": "Next »",
"page": null,
"active": false
}
],
"path": "http://localhost:8000/api/tasks",
"per_page": 15,
"to": 3,
"total": 3
}
}
```
## Обновление задачи
### Запрос PATCH|PUT
```http
PATCH /api/tasks/{id}
Content-Type: application/json
Accept: application/json
```
Запрос
```bash
curl -X PATCH "http://localhost:8000/api/tasks/26" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"is_done": true
}'
```
Ответ
```json
{
"data": {
"id": 26,
"title": "Tenetur earum.",
"is_done": true,
"due_at": "2026-02-18T15:00:00.000000Z",
"created_at": "2026-02-18T12:23:26.000000Z",
"updated_at": "2026-02-18T12:44:01.000000Z",
"tags": [
{
"id": 16,
"name": "work"
},
{
"id": 17,
"name": "backend"
}
]
}
}
```
## Получение задачи по ID
### Запрос
```http
GET /api/tasks/{id}
Accept: application/json
```
Пример
```bash
curl -X GET "http://localhost:8000/api/tasks/1" \
-H "Accept: application/json"
```
Ответ
```json
{
"data": {
"id": 1,
"title": "Ut sequi deserunt est deserunt.",
"is_done": false,
"due_at": null,
"created_at": "2026-02-18T12:06:06.000000Z",
"updated_at": "2026-02-18T12:06:06.000000Z",
"tags": [
{
"id": 1,
"name": "ut"
},
{
"id": 3,
"name": "quo"
},
{
"id": 9,
"name": "animi"
},
{
"id": 13,
"name": "dolorum"
}
]
}
}
```
## Удаление задачи
### Запрос
```http
DELETE /api/tasks/{id}
Accept: application/json
```
Запрос\Ответ
```bash
curl -i -X DELETE "http://localhost:8000/api/tasks/1" \
-H "Accept: application/json"
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: *
Cache-Control: no-cache, private
Date: Wed, 18 Feb 2026 12:50:54 GMT
Server: FrankenPHP Caddy
X-Powered-By: PHP/8.5.3
```
## Несуществующая задача
```bash
curl -X PATCH "http://localhost:8000/api/tasks/99999" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"is_done": true
}'
```
Ответ
```json
{
"message": "Record not found"
}
```