2026-01-01 18:36:34 -05:00
|
|
|
<?php
|
2026-04-13 20:56:10 -04:00
|
|
|
|
2026-02-11 14:50:06 -05:00
|
|
|
require_once __DIR__ . '/bootstrap.php';
|
2026-09-24 19:13:31 -04:00
|
|
|
require_once dirname(__DIR__) . '/services/AssignmentService.php';
|
2026-01-01 18:36:34 -05:00
|
|
|
|
|
|
|
|
// Get request data
|
|
|
|
|
$data = json_decode(file_get_contents('php://input'), true);
|
2026-03-19 22:20:43 -04:00
|
|
|
if (!is_array($data)) {
|
|
|
|
|
http_response_code(400);
|
|
|
|
|
echo json_encode(['success' => false, 'error' => 'Invalid JSON body']);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-24 19:13:31 -04:00
|
|
|
// Validation, permission check, audit log, notification and stats-cache
|
|
|
|
|
// invalidation live in AssignmentService so the MCP assign_ticket tool runs
|
|
|
|
|
// the same code path.
|
|
|
|
|
$result = AssignmentService::assign($conn, $currentUser, $data);
|
2026-01-01 18:36:34 -05:00
|
|
|
|
2026-09-24 19:13:31 -04:00
|
|
|
if (!empty($result['http_status'])) {
|
|
|
|
|
http_response_code($result['http_status']);
|
|
|
|
|
unset($result['http_status']);
|
2026-03-19 22:20:43 -04:00
|
|
|
}
|
2026-09-24 19:13:31 -04:00
|
|
|
apiRespond($result);
|