This commit is contained in:
caoyuchun 2026-01-16 13:56:25 +08:00
parent 80d465e85f
commit 61e63c599f
2 changed files with 7 additions and 5 deletions

4
Jenkinsfile vendored
View File

@ -61,8 +61,10 @@ pipeline {
# 构建后端 # 构建后端
echo "构建后端..." echo "构建后端..."
cd backend cd backend
npm run build # 先生成 Prisma Client构建时需要类型
npm run prisma:generate npm run prisma:generate
# 然后构建 TypeScript
npm run build
cd .. cd ..
''' '''
} }

View File

@ -1,12 +1,12 @@
import { PrismaClient, Prisma } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import { CourseCategory, Difficulty } from '@ai-learning/shared'; import { CourseCategory, Difficulty } from '@ai-learning/shared';
const prisma = new PrismaClient(); const prisma = new PrismaClient();
// 定义包含 chapters 的 Course 类型 // 定义包含 chapters 的 Course 类型
type CourseWithChapters = Prisma.CourseGetPayload<{ type CourseWithChapters = Awaited<ReturnType<typeof prisma.course.findMany<{
include: { chapters: true }; include: { chapters: true };
}>; }>>>[0];
// 课程依赖关系映射 // 课程依赖关系映射
const courseDependencies: Record<string, string[]> = { const courseDependencies: Record<string, string[]> = {
@ -122,7 +122,7 @@ export async function generateLearningPath(
type: 'course', type: 'course',
}); });
// 添加章节节点 // 添加章节节点
course.chapters.forEach((chapter, chapterIndex: number) => { course.chapters.forEach((chapter: { id: string }, chapterIndex: number) => {
items.push({ items.push({
courseId: course.id, courseId: course.id,
chapterId: chapter.id, chapterId: chapter.id,