import { db } from '../src/db/client.js';
import { repairChatConversationRequestLinks } from '../src/services/chat-room-service.js';

const requestedSessionId = process.argv[2]?.trim() || null;

try {
  const result = await repairChatConversationRequestLinks(requestedSessionId);
  console.log(JSON.stringify(result, null, 2));
} catch (error) {
  console.error(error);
  process.exitCode = 1;
} finally {
  await db.destroy();
}
