feat: Implement ticket commenting functionality
Adds the ability for users to comment on tickets, view comments, and distinguish between user and admin responses. Also introduces a new 'SUSPENDED' status for tickets and refactors database schema and API endpoints to support comments.
This commit is contained in:
13
server/db.js
13
server/db.js
@@ -334,6 +334,19 @@ const initDb = async () => {
|
||||
)
|
||||
`);
|
||||
|
||||
// 10. Ticket Comments Table
|
||||
await connection.query(`
|
||||
CREATE TABLE IF NOT EXISTS ticket_comments (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
ticket_id VARCHAR(36) NOT NULL,
|
||||
user_id VARCHAR(36) NOT NULL,
|
||||
text TEXT NOT NULL,
|
||||
created_at ${TIMESTAMP_TYPE} DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (ticket_id) REFERENCES tickets(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
)
|
||||
`);
|
||||
|
||||
// --- SEEDING ---
|
||||
const [rows] = await connection.query('SELECT * FROM settings WHERE id = 1');
|
||||
const defaultFeatures = {
|
||||
|
||||
Reference in New Issue
Block a user