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.
38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../helpers.php';
|
|
runAuth();
|
|
|
|
try {
|
|
queryTimed("
|
|
CREATE TABLE IF NOT EXISTS TaskRatings (
|
|
ID INT AUTO_INCREMENT PRIMARY KEY,
|
|
TaskID INT NOT NULL,
|
|
ByUserID INT NOT NULL,
|
|
ForUserID INT NOT NULL,
|
|
Direction VARCHAR(25) NOT NULL,
|
|
OnTime TINYINT(1) NULL,
|
|
CompletedScope TINYINT(1) NULL,
|
|
RequiredFollowup TINYINT(1) NULL,
|
|
ContinueAllow TINYINT(1) NULL,
|
|
Prepared TINYINT(1) NULL,
|
|
Respectful TINYINT(1) NULL,
|
|
WouldAutoAssign TINYINT(1) NULL,
|
|
AccessToken VARCHAR(64) NOT NULL UNIQUE,
|
|
ExpiresOn DATETIME NOT NULL,
|
|
CreatedOn DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
CompletedOn DATETIME NULL,
|
|
INDEX idx_task (TaskID),
|
|
INDEX idx_for_user (ForUserID),
|
|
INDEX idx_by_user (ByUserID),
|
|
INDEX idx_token (AccessToken)
|
|
)
|
|
", []);
|
|
|
|
$cols = queryTimed("DESCRIBE TaskRatings", []);
|
|
$colNames = array_column($cols, 'Field');
|
|
|
|
jsonResponse(['OK' => true, 'MESSAGE' => 'TaskRatings table created successfully', 'COLUMNS' => $colNames]);
|
|
|
|
} catch (Exception $e) {
|
|
jsonResponse(['OK' => false, 'ERROR' => $e->getMessage()]);
|
|
}
|