import { apiError, requireOwner } from "@/lib/auth";
import { publishPost } from "@/lib/publish";

export async function POST(request: Request, context: { params: Promise<{ id: string }> }) {
  try {
    const ownerId = requireOwner(request);
    const { id } = await context.params;
    return Response.json(await publishPost(id, ownerId));
  } catch (error) { return apiError(error); }
}
