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
670 B
PHP
30 lines
670 B
PHP
<?php
|
|
require_once __DIR__ . '/../helpers.php';
|
|
runAuth();
|
|
|
|
/**
|
|
* Close/complete a chat task
|
|
* POST: { TaskID: int }
|
|
*/
|
|
|
|
$data = readJsonBody();
|
|
$taskID = (int) ($data['TaskID'] ?? 0);
|
|
|
|
if ($taskID <= 0) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'missing_params', 'MESSAGE' => 'TaskID is required']);
|
|
}
|
|
|
|
try {
|
|
queryTimed("
|
|
UPDATE Tasks
|
|
SET CompletedOn = NOW()
|
|
WHERE ID = ?
|
|
AND TaskTypeID = 2
|
|
AND CompletedOn IS NULL
|
|
", [$taskID]);
|
|
|
|
jsonResponse(['OK' => true, 'MESSAGE' => 'Chat closed']);
|
|
|
|
} catch (Exception $e) {
|
|
jsonResponse(['OK' => false, 'ERROR' => 'server_error', 'MESSAGE' => $e->getMessage()]);
|
|
}
|