feat: add more roles (tech_lead, scrum_master, product_owner, designer, qa)
- Registration form: added 5 new role options to dropdown - Sidebar: new roles get proper nav access via ALL_ROLES/LEADER_ROLES - Dashboard: isLeader check expanded to include new leadership roles - Shared/Pages: role badge colors added for all new roles - Invite modal: expanded role dropdown
This commit is contained in:
53
server/db.js
53
server/db.js
@@ -1,20 +1,20 @@
|
||||
import mysql from 'mysql2/promise';
|
||||
|
||||
const pool = mysql.createPool({
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '3306'),
|
||||
user: process.env.DB_USER || 'root',
|
||||
password: process.env.DB_PASSWORD || 'scrumpass',
|
||||
database: process.env.DB_NAME || 'scrum_manager',
|
||||
waitForConnections: true,
|
||||
connectionLimit: 10,
|
||||
queueLimit: 0,
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '3306'),
|
||||
user: process.env.DB_USER || 'root',
|
||||
password: process.env.DB_PASSWORD || 'scrumpass',
|
||||
database: process.env.DB_NAME || 'scrum_manager',
|
||||
waitForConnections: true,
|
||||
connectionLimit: 10,
|
||||
queueLimit: 0,
|
||||
});
|
||||
|
||||
export async function initDB() {
|
||||
const conn = await pool.getConnection();
|
||||
try {
|
||||
await conn.query(`
|
||||
const conn = await pool.getConnection();
|
||||
try {
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
@@ -27,7 +27,7 @@ export async function initDB() {
|
||||
)
|
||||
`);
|
||||
|
||||
await conn.query(`
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS tasks (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
title VARCHAR(500) NOT NULL,
|
||||
@@ -43,7 +43,7 @@ export async function initDB() {
|
||||
)
|
||||
`);
|
||||
|
||||
await conn.query(`
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS subtasks (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
task_id VARCHAR(36) NOT NULL,
|
||||
@@ -53,7 +53,7 @@ export async function initDB() {
|
||||
)
|
||||
`);
|
||||
|
||||
await conn.query(`
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS comments (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
task_id VARCHAR(36) NOT NULL,
|
||||
@@ -65,7 +65,7 @@ export async function initDB() {
|
||||
)
|
||||
`);
|
||||
|
||||
await conn.query(`
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS activities (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
task_id VARCHAR(36) NOT NULL,
|
||||
@@ -75,7 +75,7 @@ export async function initDB() {
|
||||
)
|
||||
`);
|
||||
|
||||
await conn.query(`
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS task_tags (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
task_id VARCHAR(36) NOT NULL,
|
||||
@@ -85,10 +85,23 @@ export async function initDB() {
|
||||
)
|
||||
`);
|
||||
|
||||
console.log('✅ Database tables initialized');
|
||||
} finally {
|
||||
conn.release();
|
||||
}
|
||||
await conn.query(`
|
||||
CREATE TABLE IF NOT EXISTS dependencies (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
task_id VARCHAR(36) NOT NULL,
|
||||
depends_on_user_id VARCHAR(36),
|
||||
description TEXT NOT NULL,
|
||||
resolved BOOLEAN DEFAULT FALSE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (depends_on_user_id) REFERENCES users(id) ON DELETE SET NULL
|
||||
)
|
||||
`);
|
||||
|
||||
console.log('✅ Database tables initialized');
|
||||
} finally {
|
||||
conn.release();
|
||||
}
|
||||
}
|
||||
|
||||
export default pool;
|
||||
|
||||
Reference in New Issue
Block a user