Restrict AI Studio to teachers/admins only + Save to Lesson feature
Access Control: - AI Studio view checks user role: only SCHOOL_ADMIN, SUPER_ADMIN, TEACHER, VICE_PRINCIPAL - Students and parents see 'Kein Zugriff' (No Access) message - AI Studio removed from student navigation - API routes (/api/ai/snapgen, /api/ai/perchance, /api/ai/lesson-plan, /api/ai/agent) enforce role checks New Features: - 'Save to Lesson' dialog in Video and Image generation tabs - Pick Subject > Topic > Lesson from existing curriculum - Saves AI video/image URL to SubjectLesson record - Stores prompt, provider, timestamp, and teacher who generated - Students will see this content in homework and lesson materials - AI Lesson Plan API route (/api/ai/lesson-plan) - AI Agent Chat API route (/api/ai/agent) with context-aware system prompts - SubjectLesson model: Added aiVideoUrl, aiImageUrl, aiThumbnailUrl, aiPrompt, aiProvider, aiGeneratedAt, aiGeneratedBy - Homework model: Added aiLessonId, aiVideoUrl, aiImageUrl for linking AI content Navigation: - Removed duplicate AI Studio entry from teacher nav - Removed AI Studio from student nav (students can't access)
This commit is contained in:
1 parent
763ebef22b
commit
fe3eb4a272
6 files changed
+422
-10
No files matched your search
+13
-1
@@ -1376,9 +1376,13 @@ model Homework {
|
||||
attachments String? // JSON array of attachment URLs
|
||||
isPublished Boolean @default(true)
|
||||
isDemo Boolean @default(false)
|
||||
// AI-generated content linked from SubjectLesson
|
||||
aiLessonId String? // link to SubjectLesson with AI content
|
||||
aiVideoUrl String? // direct AI video URL for this homework
|
||||
aiImageUrl String? // direct AI image URL for this homework
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
deletedAt DateTime?
|
||||
|
||||
school School @relation(fields: [schoolId], references: [id])
|
||||
classGroup ClassGroup @relation(fields: [classGroupId], references: [id])
|
||||
@@ -2181,6 +2185,14 @@ model SubjectLesson {
|
||||
sortOrder Int @default(0)
|
||||
estimatedMinutes Int? // estimated time to complete
|
||||
isDemo Boolean @default(false)
|
||||
// AI-generated content (created by teachers/admins)
|
||||
aiVideoUrl String? // AI-generated explanatory video URL
|
||||
aiImageUrl String? // AI-generated illustration image URL
|
||||
aiThumbnailUrl String? // Video thumbnail
|
||||
aiPrompt String? // Original prompt used for generation
|
||||
aiProvider String? // "snapgen" | "perchance" | "zai"
|
||||
aiGeneratedAt DateTime?
|
||||
aiGeneratedBy String? // userId of teacher/admin who generated
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
|
||||
Reference in new issue
Block a user