import { getAllPlans } from '../../database/queries/stripe'
import { handleApiError, createSuccessResponse } from '../../utils/errors'

export default defineEventHandler(async (_event) => {
  try {
    const plans = await getAllPlans()
    return createSuccessResponse(plans, 'Plans retrieved successfully')
  } catch (error) {
    throw handleApiError(error)
  }
})
