import { duplicatePortfolio } from '../../../lib/portfolio-store'

export default defineEventHandler(async (event) => {
  const copy = await duplicatePortfolio(getRouterParam(event, 'id')!)
  if (!copy) throw createError({ statusCode: 404, statusMessage: 'Portfolio introuvable' })
  return copy
})
