Update README.md and add debug error handlers

- Completely rewrote README with all new features and admin routes
- Cleaned up remaining migration files
- Added detailed PHP error/exception handlers to dependencies API
  to help debug the 500 error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-20 17:25:54 -05:00
parent 7462d7c509
commit 08d6808bc3
6 changed files with 145 additions and 281 deletions

View File

@@ -1,15 +0,0 @@
-- Migration: Create ticket dependencies table
-- Version: 015
CREATE TABLE IF NOT EXISTS ticket_dependencies (
dependency_id INT AUTO_INCREMENT PRIMARY KEY,
ticket_id VARCHAR(9) NOT NULL,
depends_on_id VARCHAR(9) NOT NULL,
dependency_type ENUM('blocks', 'blocked_by', 'relates_to', 'duplicates') DEFAULT 'blocks',
created_by INT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY unique_dependency (ticket_id, depends_on_id, dependency_type),
INDEX idx_ticket_id (ticket_id),
INDEX idx_depends_on_id (depends_on_id),
FOREIGN KEY (created_by) REFERENCES users(user_id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@@ -1,18 +0,0 @@
-- Migration: Create ticket attachments table
-- Date: 2026-01-19
-- Description: Adds support for file attachments on tickets
CREATE TABLE IF NOT EXISTS ticket_attachments (
attachment_id INT AUTO_INCREMENT PRIMARY KEY,
ticket_id VARCHAR(9) NOT NULL,
filename VARCHAR(255) NOT NULL,
original_filename VARCHAR(255) NOT NULL,
file_size INT NOT NULL,
mime_type VARCHAR(100) NOT NULL,
uploaded_by INT NULL,
uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (ticket_id) REFERENCES tickets(ticket_id) ON DELETE CASCADE,
FOREIGN KEY (uploaded_by) REFERENCES users(user_id) ON DELETE SET NULL,
INDEX idx_attachments_ticket (ticket_id),
INDEX idx_attachments_uploaded_by (uploaded_by)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@@ -1,29 +0,0 @@
-- Migration: Create recurring tickets table
-- Description: Enables automatic ticket creation on a schedule
CREATE TABLE IF NOT EXISTS recurring_tickets (
recurring_id INT AUTO_INCREMENT PRIMARY KEY,
title_template VARCHAR(255) NOT NULL,
description_template TEXT,
category VARCHAR(50) DEFAULT 'General',
type VARCHAR(50) DEFAULT 'Task',
priority INT DEFAULT 4,
assigned_to INT NULL,
schedule_type ENUM('daily', 'weekly', 'monthly') NOT NULL,
schedule_day INT NULL COMMENT 'Day of week (1-7) for weekly, day of month (1-31) for monthly',
schedule_time TIME DEFAULT '09:00:00',
next_run_at TIMESTAMP NOT NULL,
last_run_at TIMESTAMP NULL,
is_active BOOLEAN DEFAULT TRUE,
created_by INT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (assigned_to) REFERENCES users(user_id) ON DELETE SET NULL,
FOREIGN KEY (created_by) REFERENCES users(user_id) ON DELETE SET NULL,
INDEX idx_recurring_next_run (next_run_at, is_active),
INDEX idx_recurring_active (is_active)
);
-- Sample recurring ticket for testing (commented out)
-- INSERT INTO recurring_tickets (title_template, description_template, category, type, schedule_type, schedule_day, next_run_at)
-- VALUES ('Weekly Server Maintenance Check', 'Perform weekly server health check and maintenance tasks.', 'Maintenance', 'Task', 'weekly', 1, NOW());

View File

@@ -1,39 +0,0 @@
-- Migration: Create custom fields tables
-- Description: Enables custom field definitions per category and stores field values
-- Custom field definitions
CREATE TABLE IF NOT EXISTS custom_field_definitions (
field_id INT AUTO_INCREMENT PRIMARY KEY,
field_name VARCHAR(100) NOT NULL,
field_label VARCHAR(255) NOT NULL,
field_type ENUM('text', 'textarea', 'select', 'checkbox', 'date', 'number') NOT NULL,
field_options JSON NULL COMMENT 'Options for select fields: {"options": ["Option 1", "Option 2"]}',
category VARCHAR(50) NULL COMMENT 'NULL = applies to all categories',
is_required BOOLEAN DEFAULT FALSE,
display_order INT DEFAULT 0,
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_custom_fields_category (category, is_active),
INDEX idx_custom_fields_order (display_order)
);
-- Custom field values for tickets
CREATE TABLE IF NOT EXISTS custom_field_values (
value_id INT AUTO_INCREMENT PRIMARY KEY,
ticket_id VARCHAR(9) NOT NULL,
field_id INT NOT NULL,
field_value TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY unique_ticket_field (ticket_id, field_id),
FOREIGN KEY (field_id) REFERENCES custom_field_definitions(field_id) ON DELETE CASCADE,
INDEX idx_custom_values_ticket (ticket_id)
);
-- Sample custom field definitions (commented out)
-- INSERT INTO custom_field_definitions (field_name, field_label, field_type, category, is_required)
-- VALUES
-- ('affected_server', 'Affected Server', 'text', 'Hardware', false),
-- ('incident_date', 'Incident Date', 'date', 'Security', true),
-- ('software_version', 'Software Version', 'text', 'Software', false);