import { Router } from 'express';
import { testDbConnection } from '../database'; // 只导入 testDbConnection

const router = Router();

router.get('/health', async (req, res) => {
  try {
    const dbStatus = await testDbConnection();
    res.json({
      status: 'UP',
      database: dbStatus
    });
  } catch (error) {
    const err = error as Error;
    res.status(500).json({
      status: 'DOWN',
      error: err.message
    });
  }
});

// 移除 create-table 路由，因为我们在 initializeDatabase 中处理了表创建

export default router;