Refactor entry API: consolidate entry handling, update naming conventions, and enhance error reporting

This commit is contained in:
marc-go committed 2026-10-11 19:19:36 +02:00
1 parent 205f2e2f73
commit ad9290d2ad
9 files changed
+72 -12

No files matched your search

File renamed without changes.
File renamed without changes.
+37
View File
@@ -0,0 +1,37 @@
<?php
// Set internal to false so that the answer goes to the client
if (!isset($internal)) {
$internal = false;
define("API_DIR", "../");
}
// Load Main Library
require_once API_DIR . "api.php";
$api = new gbAPI(true, $internal);
$input = $api->getInput();
// Check given Status
if (!isset($input["status"])) {
$api->answer(400, [
"error" => "missing_fields",
"error_text" => "Some fields are missing"
], true);
return;
}
if ($status !== 0 && $status !== 1 && $status !== 2) {
$api->answer(400, [
"error" => "status_invalid",
"error_text" => "The given status is invalid."
], true);
}
$command = "SELECT * FROM entrys WHERE status = :status";
$response = $api->dbCommand($command, true, true, [
":status" => $status
]);