import { healthCheck } from '../../utils/db.js'

export default defineEventHandler(async () => {
  const health = await healthCheck()
  if (!health.healthy) {
    throw createError({ statusCode: 503, message: 'Database not ready' })
  }
  return { status: 'ready' }
})
