2026-01-20 09:55:01 -05:00
|
|
|
<?php
|
2026-04-13 20:56:10 -04:00
|
|
|
|
2026-01-20 09:55:01 -05:00
|
|
|
/**
|
|
|
|
|
* Check for duplicate tickets API
|
|
|
|
|
*
|
|
|
|
|
* Searches for tickets with similar titles using LIKE and SOUNDEX
|
|
|
|
|
*/
|
|
|
|
|
|
2026-02-11 14:50:06 -05:00
|
|
|
require_once __DIR__ . '/bootstrap.php';
|
2026-01-20 09:55:01 -05:00
|
|
|
require_once dirname(__DIR__) . '/helpers/ResponseHelper.php';
|
2026-09-26 17:08:04 -04:00
|
|
|
require_once dirname(__DIR__) . '/services/SimilarTicketService.php';
|
2026-01-20 09:55:01 -05:00
|
|
|
|
|
|
|
|
// Only accept GET requests
|
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
|
|
|
|
|
ResponseHelper::error('Method not allowed', 405);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get title parameter
|
|
|
|
|
$title = isset($_GET['title']) ? trim($_GET['title']) : '';
|
|
|
|
|
|
2026-09-26 17:08:04 -04:00
|
|
|
ResponseHelper::success(['duplicates' => SimilarTicketService::find($conn, $currentUser, $title)]);
|