Add OBS group management feature and documentation
- Add group_name column to teams table for mapping teams to OBS groups - Create API endpoints for group creation (/api/createGroup) and bulk sync (/api/syncGroups) - Update teams UI with group status display and creation buttons - Implement automatic group assignment when adding streams - Add comprehensive OBS setup documentation (docs/OBS_SETUP.md) - Fix team list spacing issue with explicit margins - Update OBS client with group management functions - Add database migration script for existing deployments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c259f0d943
commit
5789986bb6
14 changed files with 540 additions and 144 deletions
57
scripts/addGroupNameToTeams.ts
Normal file
57
scripts/addGroupNameToTeams.ts
Normal file
|
@ -0,0 +1,57 @@
|
|||
import sqlite3 from 'sqlite3';
|
||||
import { open } from 'sqlite';
|
||||
import path from 'path';
|
||||
import { getTableName, BASE_TABLE_NAMES } from '../lib/constants';
|
||||
|
||||
const FILE_DIRECTORY = path.resolve(process.env.FILE_DIRECTORY || './files');
|
||||
|
||||
const addGroupNameToTeams = async () => {
|
||||
try {
|
||||
const dbPath = path.join(FILE_DIRECTORY, 'sources.db');
|
||||
|
||||
// Open database connection
|
||||
const db = await open({
|
||||
filename: dbPath,
|
||||
driver: sqlite3.Database,
|
||||
});
|
||||
|
||||
console.log('Database connection established.');
|
||||
|
||||
// Generate table name for teams
|
||||
const teamsTableName = getTableName(BASE_TABLE_NAMES.TEAMS, {
|
||||
year: 2025,
|
||||
season: 'summer',
|
||||
suffix: 'sat'
|
||||
});
|
||||
|
||||
console.log(`Adding group_name column to ${teamsTableName}`);
|
||||
|
||||
// Check if column already exists
|
||||
const tableInfo = await db.all(`PRAGMA table_info(${teamsTableName})`);
|
||||
const hasGroupName = tableInfo.some(col => col.name === 'group_name');
|
||||
|
||||
if (!hasGroupName) {
|
||||
// Add group_name column
|
||||
await db.exec(`
|
||||
ALTER TABLE ${teamsTableName}
|
||||
ADD COLUMN group_name TEXT
|
||||
`);
|
||||
|
||||
console.log(`✅ Added group_name column to ${teamsTableName}`);
|
||||
} else {
|
||||
console.log(`ℹ️ group_name column already exists in ${teamsTableName}`);
|
||||
}
|
||||
|
||||
// Close database connection
|
||||
await db.close();
|
||||
console.log('Database connection closed.');
|
||||
console.log('✅ Successfully updated teams table schema!');
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error updating table:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
// Run the script
|
||||
addGroupNameToTeams();
|
|
@ -60,7 +60,8 @@ const createSatSummer2025Tables = async () => {
|
|||
await db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS ${teamsTableName} (
|
||||
team_id INTEGER PRIMARY KEY,
|
||||
team_name TEXT NOT NULL
|
||||
team_name TEXT NOT NULL,
|
||||
group_name TEXT
|
||||
)
|
||||
`);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue