20 lines
380 B
TypeScript
20 lines
380 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
export async function GET() {
|
|
const now = new Date();
|
|
|
|
await prisma.blog.updateMany({
|
|
where: {
|
|
status: "SCHEDULED",
|
|
scheduledAt: { lte: now },
|
|
},
|
|
data: {
|
|
status: "PUBLISHED",
|
|
publishedAt: now,
|
|
},
|
|
});
|
|
|
|
return NextResponse.json({ success: true });
|
|
}
|