feat: post saving, instant publish, scheduling, post history per channel

This commit is contained in:
Alexey Pavlov
2026-05-31 17:36:02 +03:00
parent e2b64baf2e
commit 1a1eac16ee
5 changed files with 262 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
import { NextResponse } from 'next/server';
import { requireUser } from '@/lib/session';
import { engine } from '@/lib/engine';
export async function PATCH(req, { params }) {
const user = await requireUser();
if (!user) return NextResponse.json({error:'Unauthorized'},{status:401});
const { id } = await params;
const body = await req.json();
try {
const data = await engine.updatePost(user.id, id, body);
return NextResponse.json(data);
} catch (e) { return NextResponse.json({error:e.message},{status:500}); }
}
export async function DELETE(req, { params }) {
const user = await requireUser();
if (!user) return NextResponse.json({error:'Unauthorized'},{status:401});
const { id } = await params;
try {
await engine.deletePost(user.id, id);
return NextResponse.json({ok:true});
} catch (e) { return NextResponse.json({error:e.message},{status:500}); }
}