优化图文页

This commit is contained in:
2026-04-28 17:11:42 +08:00
parent 674c202264
commit 040273586b
69 changed files with 3939 additions and 2302 deletions
+8 -8
View File
@@ -1,11 +1,11 @@
import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import { getFileUrl } from '@/lib/minio';
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { getFileUrl } from "@/lib/minio";
export async function GET() {
try {
const videos = await prisma.video.findMany({
orderBy: { created_at: 'desc' },
orderBy: { created_at: "desc" },
take: 1000,
include: {
author: {
@@ -29,7 +29,7 @@ export async function GET() {
const formattedVideos = videos.map((v) => ({
aweme_id: v.aweme_id,
desc: v.desc,
cover_url: getFileUrl(v.cover_url ?? ''),
cover_url: getFileUrl(v.cover_url ?? ""),
duration_ms: v.duration_ms,
author: {
nickname: v.author.nickname,
@@ -51,10 +51,10 @@ export async function GET() {
total: videos.length,
});
} catch (error) {
console.error('Failed to fetch videos:', error);
console.error("Failed to fetch videos:", error);
return NextResponse.json(
{ error: 'Failed to fetch videos' },
{ status: 500 }
{ error: "Failed to fetch videos" },
{ status: 500 },
);
}
}