Complete port of all 163 API endpoints from Lucee/CFML to PHP 8.3. Shared helpers in api/helpers.php (DB, auth, request/response, security). PDO prepared statements throughout. Same JSON response shapes as CFML.
30 lines
725 B
PHP
30 lines
725 B
PHP
<?php
|
|
require_once __DIR__ . '/../helpers.php';
|
|
runAuth();
|
|
|
|
/**
|
|
* Set Business Hiring Status
|
|
* POST: { BusinessID, IsHiring: bool }
|
|
*/
|
|
|
|
$data = readJsonBody();
|
|
$businessId = (int) ($data['BusinessID'] ?? 0);
|
|
|
|
if ($businessId <= 0) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'missing_business_id']);
|
|
}
|
|
|
|
if (!isset($data['IsHiring'])) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'missing_is_hiring']);
|
|
}
|
|
|
|
$isHiring = $data['IsHiring'] ? 1 : 0;
|
|
|
|
try {
|
|
queryTimed("UPDATE Businesses SET IsHiring = ? WHERE ID = ?", [$isHiring, $businessId]);
|
|
|
|
jsonResponse(['OK' => true, 'IsHiring' => $isHiring === 1]);
|
|
|
|
} catch (Exception $e) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'server_error', 'MESSAGE' => $e->getMessage()]);
|
|
}
|