index.ts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import 'dotenv/config';
  2. import './shared/db/parse-client.js';
  3. import { ensureSchemas } from './shared/db/schema-setup.js';
  4. import { bootstrapOrganization } from './shared/db/organization-bootstrap.js';
  5. import { bootstrapAuth } from './apps/pc/auth/services/auth.service.js';
  6. import { prepareGroupListForDisplay } from './apps/pc/qiwe/services/groups.service.js';
  7. async function bootstrap(): Promise<void> {
  8. console.log('[Setup] 检查 Parse Schema...');
  9. await ensureSchemas();
  10. console.log('[Setup] Schema 检查完毕');
  11. await bootstrapOrganization();
  12. await bootstrapAuth();
  13. if (process.env.QIWE_GUID) {
  14. const created = await prepareGroupListForDisplay();
  15. if (created > 0) {
  16. console.log(`[Setup] 已从历史消息补全 ${created} 个群`);
  17. }
  18. }
  19. }
  20. await import('./apps/pc/health/server.js');
  21. void bootstrap().catch((err: unknown) => {
  22. const message = err instanceof Error ? err.message : String(err);
  23. console.error('[Setup] 后台初始化失败(HTTP 服务已启动):', message);
  24. });