-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinspect-lesson.js
More file actions
48 lines (38 loc) · 1.33 KB
/
Copy pathinspect-lesson.js
File metadata and controls
48 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { createClient } = require('@supabase/supabase-js');
require('dotenv').config({ path: '.env.local' });
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
if (!supabaseUrl || !supabaseKey) {
console.error('Missing Supabase credentials');
process.exit(1);
}
const supabase = createClient(supabaseUrl, supabaseKey);
async function inspectLesson(lessonId) {
console.log(`Inspecting Lesson ID: ${lessonId}`);
// Fetch Lesson
const { data: lesson, error: lessonError } = await supabase
.from('learning_lessons')
.select('*')
.eq('id', lessonId)
.single();
if (lessonError) {
console.error('Error fetching lesson:', lessonError);
return;
}
console.log('Lesson:', lesson);
// Fetch Steps
const { data: steps, error: stepsError } = await supabase
.from('lesson_steps')
.select('*')
.eq('lesson_id', lessonId)
.order('step_order', { ascending: true });
if (stepsError) {
console.error('Error fetching steps:', stepsError);
return;
}
console.log(`Found ${steps.length} steps:`);
steps.forEach((step, i) => {
console.log(`Step ${i + 1} (${step.step_type}):`, JSON.stringify(step.content, null, 2));
});
}
inspectLesson(9);