import type { RequestHandler } from '@sveltejs/kit'; import PocketBase from 'pocketbase'; const PB_DB = process.env.PB_DB || 'https://pocketbase.ccllc.pro'; export const GET: RequestHandler = async ({ params }) => { try { const pb = new PocketBase(PB_DB); const record = await pb.collection('pbc_1407612689').getOne(params.id!); return new Response(JSON.stringify(record), { headers: { 'Content-Type': 'application/json' }, }); } catch (error) { return new Response( JSON.stringify({ error: error instanceof Error ? error.message : 'Job not found', }), { status: 404, headers: { 'Content-Type': 'application/json' } } ); } }; export const PATCH: RequestHandler = async ({ params, request }) => { try { const pb = new PocketBase(PB_DB); const data = await request.json(); const updated = await pb.collection('pbc_1407612689').update(params.id!, data); return new Response(JSON.stringify(updated), { headers: { 'Content-Type': 'application/json' }, }); } catch (error) { return new Response( JSON.stringify({ error: error instanceof Error ? error.message : 'Failed to update job', }), { status: 500, headers: { 'Content-Type': 'application/json' } } ); } };