feat: autogen time picker, channel schedule tab with publish slots
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { checkAdminAuth } from '@/lib/adminAuth';
|
||||
const E = process.env.ENGINE_URL||'http://127.0.0.1:3030';
|
||||
const S = process.env.ENGINE_SECRET||'zeropost_internal_2026';
|
||||
|
||||
export async function DELETE(req, { params }) {
|
||||
if (!(await checkAdminAuth())) return NextResponse.json({error:'Unauthorized'},{status:401});
|
||||
const { id, slotId } = await params;
|
||||
await fetch(`${E}/api/channels/admin/${id}/slots/${slotId}`,{method:'DELETE',headers:{'x-internal-secret':S}});
|
||||
return NextResponse.json({ok:true});
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { checkAdminAuth } from '@/lib/adminAuth';
|
||||
const E = process.env.ENGINE_URL||'http://127.0.0.1:3030';
|
||||
const S = process.env.ENGINE_SECRET||'zeropost_internal_2026';
|
||||
const h = {'Content-Type':'application/json','x-internal-secret':S};
|
||||
|
||||
export async function GET(req, { params }) {
|
||||
if (!(await checkAdminAuth())) return NextResponse.json({error:'Unauthorized'},{status:401});
|
||||
const { id } = await params;
|
||||
const res = await fetch(`${E}/api/channels/admin/${id}/slots`, { headers: h });
|
||||
return NextResponse.json(await res.json());
|
||||
}
|
||||
export async function POST(req, { params }) {
|
||||
if (!(await checkAdminAuth())) return NextResponse.json({error:'Unauthorized'},{status:401});
|
||||
const { id } = await params;
|
||||
const body = await req.json();
|
||||
const res = await fetch(`${E}/api/channels/admin/${id}/slots`, {method:'POST',headers:h,body:JSON.stringify(body)});
|
||||
return NextResponse.json(await res.json());
|
||||
}
|
||||
Reference in New Issue
Block a user