import 'dotenv/config'; import './shared/db/parse-client.js'; import { ensureSchemas } from './shared/db/schema-setup.js'; import { bootstrapOrganization } from './shared/db/organization-bootstrap.js'; import { bootstrapAuth } from './apps/pc/auth/services/auth.service.js'; import { prepareGroupListForDisplay } from './apps/pc/qiwe/services/groups.service.js'; async function bootstrap(): Promise { console.log('[Setup] 检查 Parse Schema...'); await ensureSchemas(); console.log('[Setup] Schema 检查完毕'); await bootstrapOrganization(); await bootstrapAuth(); if (process.env.QIWE_GUID) { const created = await prepareGroupListForDisplay(); if (created > 0) { console.log(`[Setup] 已从历史消息补全 ${created} 个群`); } } } await import('./apps/pc/health/server.js'); void bootstrap().catch((err: unknown) => { const message = err instanceof Error ? err.message : String(err); console.error('[Setup] 后台初始化失败(HTTP 服务已启动):', message); });