move next to web-front

This commit is contained in:
2026-05-17 01:08:19 +03:00
parent cc219cdb26
commit 9e53a7b4fc
52 changed files with 1442 additions and 175 deletions
@@ -0,0 +1,29 @@
import 'server-only';
import { unstable_cache } from 'next/cache';
import { DB_MEMORY_TTL_MS, NEXT_CACHE_REVALIDATE_SECONDS } from '@/shared/config/env';
import { calculateVideoStats } from '@/entities/video/model/video';
import { listVideos } from './videoRepository';
export const VIDEO_COLLECTION_TAG = 'video-collection';
export const getCachedVideoDashboard = unstable_cache(
async () => {
const videos = await listVideos();
return {
videos,
stats: calculateVideoStats(videos),
cache: {
generatedAt: new Date().toISOString(),
nextRevalidateSeconds: NEXT_CACHE_REVALIDATE_SECONDS,
memoryTtlMs: DB_MEMORY_TTL_MS,
},
};
},
['video-dashboard-v1'],
{
revalidate: NEXT_CACHE_REVALIDATE_SECONDS,
tags: [VIDEO_COLLECTION_TAG],
},
);