import { NextResponse } from 'next/server'; import { withAuth, withPermission } from '@/lib/api/helpers'; import { errorResponse } from '@/lib/errors'; import { getPreviewUrl } from '@/lib/services/files'; export const GET = withAuth( withPermission('files', 'view', async (req, ctx, params) => { try { const result = await getPreviewUrl(params.id!, ctx.portId); return NextResponse.json({ data: result }); } catch (error) { return errorResponse(error); } }), );