Restore videoreg public guide site with static isolated deployment
Production container deploy / production (push) Failing after 2m34s
Production container deploy / production (push) Failing after 2m34s
This commit is contained in:
1 parent
2ce58fcbc0
commit
53e4f06486
35 files changed
+599
-355
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { revalidatePath, revalidateTag } from 'next/cache';
|
||||
import { getCachedVideoDashboard, VIDEO_COLLECTION_TAG } from '@/entities/video/api/videoCache';
|
||||
import { addVideo } from '@/entities/video/api/videoRepository';
|
||||
import { normalizeVideoDraft } from '@/entities/video/model/video';
|
||||
|
||||
export const revalidate = 3600;
|
||||
|
||||
export async function GET() {
|
||||
const dashboard = await getCachedVideoDashboard();
|
||||
|
||||
return NextResponse.json(dashboard, {
|
||||
headers: {
|
||||
'cache-control': 'public, max-age=60, s-maxage=3600, stale-while-revalidate=86400',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = (await request.json().catch(() => undefined)) as
|
||||
| { title?: string; owner?: string; sourceUrl?: string; status?: string }
|
||||
| undefined;
|
||||
|
||||
const video = await addVideo(normalizeVideoDraft(body ?? {}));
|
||||
revalidateTag(VIDEO_COLLECTION_TAG, { expire: 0 });
|
||||
revalidatePath('/');
|
||||
|
||||
return NextResponse.json({ video }, { status: 201 });
|
||||
}
|
||||
Reference in new issue
Block a user