Skip to content

Commit

Permalink
173.0.38
Browse files Browse the repository at this point in the history
- [FIX] Исправлена мелкие проблемы с маршутизацией
- [UPDATE] Изменён класс работы с базой данных на `illuminate/database`
- [UPDATE] Изменён подход к маршрутизации
- [NEW] Добавлен новый маршрут для поиска по значениям /search/{db_table}. Подробнее в документации
- [NEW] Добавлен к каждой таблице новый вид маршрутизации /{db_table/{id} для метода запроса GET, чтобы получить лишь одну запись. Для таблицы post данный метод является расширенным. В нём парсятся категории и доп. поля
  • Loading branch information
Gokujo committed Jan 10, 2025
1 parent 29830b2 commit 4a70026
Show file tree
Hide file tree
Showing 2,430 changed files with 185,011 additions and 2,006 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "160.0.35",
"version": "173.0.38",
"name": "DLE API"
}
Empty file modified upload/api/.htaccess
100644 → 100755
Empty file.
6 changes: 4 additions & 2 deletions upload/api/composer.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"ext-pdo": "*",
"ext-simplexml": "*",
"php-di/php-di": "^7.0",
"slim/psr7": "^1.7"
"slim/psr7": "^1.7",
"illuminate/database": "^11.37"
},
"config": {
"platform": {
"php": "8.3"
}
},
}

}
2,482 changes: 1,922 additions & 560 deletions upload/api/composer.lock
100644 → 100755

Large diffs are not rendered by default.

Empty file modified upload/api/composer.phar
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions upload/api/includes/CacheSystem.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php


/**
* Система кеширования запросов
*/
Expand Down
268 changes: 127 additions & 141 deletions upload/api/includes/CrudController.php
100644 → 100755

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions upload/api/includes/ErrorResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Psr\Http\Message\ResponseInterface;


abstract class ErrorResponse {
public static array $error_types
= [
200 => "Успешный ответ",
201 => "Запись успешно создана / обновлена",
204 => "Запись успешно удалена",
400 => "При создании / обновлении записи возникла ошибка",
401 => "Неверный API-ключ или отсутствие прав доступа",
404 => "Указанная запись не найдена",
];

public static function error(ResponseInterface $response, int $errorNumber, ?string $errorMessage = null): ResponseInterface {
$response->getBody()->write(
json_encode(
[
"error" => !in_array($errorNumber, [200, 201, 204]),
"status" => $errorNumber,
"description" => ErrorResponse::$error_types[$errorNumber],
"message" => $errorMessage ?? errorResponse::$error_types[$errorNumber]
], JSON_UNESCAPED_UNICODE
)
);

return $response->withStatus($errorNumber)->withHeader('Content-Type', 'application/json; charset=UTF-8');
}

public static function success(ResponseInterface $response, mixed $data = null, int $status = 201): ResponseInterface {
$response->getBody()->write($data);
return $response->withStatus($status)->withHeader('Content-Type', 'application/json; charset=UTF-8');
}

}
40 changes: 0 additions & 40 deletions upload/api/includes/PDO.Iterator.class.php

This file was deleted.

35 changes: 0 additions & 35 deletions upload/api/includes/PDO.Log.class.php

This file was deleted.

Loading

0 comments on commit 4a70026

Please sign in to comment.