Files
radio-explorer/server/scripts/check-multiuser.js
Marco Mooren 29423288ca feat: add multi-user support for favorites management and room clock synchronization
- Implemented a new API endpoint for retrieving and managing user favorites in /api/users.
- Added functionality for admins to edit the shared "main" user's favorites.
- Created a one-shot DB smoke test script for verifying multi-user kiosk migrations.
- Introduced a RoomClock class for synchronizing server time across clients using WebSocket.
2026-05-13 13:53:12 +02:00

25 lines
1.3 KiB
JavaScript

// One-shot DB smoke test for the multi-user kiosk migrations.
import { initDb, getDb } from '../db/index.js';
import { ensureMainUser, getMainUser } from '../auth.js';
import { app } from 'electron';
initDb(process.env.DB_PATH || './data/db/oradio.sqlite');
const db = getDb();
ensureMainUser(process.env.MAIN_USER || 'morphix');
const userCols = db.prepare("PRAGMA table_info(users)").all().map((c) => c.name);
const deviceCols = db.prepare("PRAGMA table_info(kiosk_devices)").all().map((c) => c.name);
const wlCols = db.prepare("PRAGMA table_info(kiosk_device_users)").all().map((c) => c.name);
const roomStateCols = db.prepare("PRAGMA table_info(room_state)").all().map((c) => c.name);
const users = db.prepare('SELECT id, username, role, is_main, avatar_color, avatar_emoji FROM users').all();
const mainCount = db.prepare('SELECT count(*) AS c FROM users WHERE is_main = 1').get().c;
console.log('users cols: ', userCols.join(', '));
console.log('kiosk_devices cols: ', deviceCols.join(', '));
console.log('kiosk_device_users: ', wlCols.join(', '));
console.log('room_state cols: ', roomStateCols.join(', '));
console.log('users: ', JSON.stringify(users, null, 2));
console.log('main user count: ', mainCount);
console.log('getMainUser(): ', getMainUser());
app.quit();