import type { APIRoute } from 'astro'; import { updateCV } from '../../../../lib/db'; export const PUT: APIRoute = async ({ request, locals, params }) => { try { const user = locals.user; const id = params.id!; const body = await request.json(); updateCV(id, user.id, { title: body.title, template: body.template, settings: body.settings, public: body.public, }); return new Response(JSON.stringify({ ok: true }), { status: 200, headers: { 'Content-Type': 'application/json' } }); } catch (err: any) { return new Response(JSON.stringify({ error: err.message }), { status: 500, headers: { 'Content-Type': 'application/json' } }); } };