4313 lines
83 KiB
JavaScript
4313 lines
83 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Courses = db.courses;
|
|
|
|
const CourseCategories = db.course_categories;
|
|
|
|
const Lessons = db.lessons;
|
|
|
|
const Enrollments = db.enrollments;
|
|
|
|
const LessonProgress = db.lesson_progress;
|
|
|
|
const CourseAnnouncements = db.course_announcements;
|
|
|
|
const LessonQuizzes = db.lesson_quizzes;
|
|
|
|
const QuizQuestions = db.quiz_questions;
|
|
|
|
const QuizAnswerChoices = db.quiz_answer_choices;
|
|
|
|
const QuizAttempts = db.quiz_attempts;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CoursesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Modern Web Foundations",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "modern-web-foundations",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtitle": "Build a solid web development base",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "A structured path through HTML, CSS, JavaScript, and core tooling with practical exercises.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"level": "beginner",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-15T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Next.js for Practical Apps",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "nextjs-for-practical-apps",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtitle": "From routing to deployment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Learn how to ship production-ready apps with Next.js, data fetching, and best practices.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"level": "beginner",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 49.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-20T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "SQL for Busy Professionals",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "sql-for-busy-professionals",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtitle": "Query confidently in real projects",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "A practical SQL course covering querying, joins, aggregations, and reporting patterns.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"level": "advanced",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 29.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-25T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "UX Research Essentials",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "ux-research-essentials",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtitle": "Make informed product decisions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Plan and run lightweight research, synthesize findings, and communicate insights.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"level": "intermediate",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 39.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-03-01T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Career Toolkit for Developers",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "career-toolkit-for-developers",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtitle": "Resume, interviews, and portfolio",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Templates and drills to present your work effectively and prepare for interviews.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"level": "all_levels",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 19.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-03-05T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CourseCategoriesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Web Development",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Frontend and backend fundamentals for building web apps.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#2563EB",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Data Analytics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Practical analytics skills using spreadsheets and SQL.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#059669",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "UX Design",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "User experience principles, research, and interface design.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#DB2777",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Career Skills",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Interview prep, communication, and portfolio building.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#F59E0B",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Productivity",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Workflows and habits for consistent learning.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#6D28D9",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LessonsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "HTML Structure and Semantics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Use semantic elements for accessible structure.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"content": "Learn page structure, headings, landmarks, and semantic tags with examples.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"video_url": "https://videos.example/modern-web/html-semantics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_minutes": 25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-15T10:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "CSS Layout with Flexbox",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Build common layouts with Flexbox.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"content": "Practice alignment, spacing, and responsive patterns using Flexbox utilities.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"video_url": "https://videos.example/modern-web/flexbox",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_minutes": 35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-15T10:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "JavaScript Basics for the DOM",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Add interactivity with events and selectors.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"content": "Select elements, handle events, and update content safely.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"video_url": "https://videos.example/modern-web/js-dom",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_minutes": 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-15T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Next.js Routing and Layouts",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Create pages with the app router.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"content": "Understand layouts, nested routes, and navigation patterns.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"video_url": "https://videos.example/nextjs/routing-layouts",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_minutes": 45,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-20T10:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "SELECT, WHERE, and ORDER BY",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Write readable queries with filters and sorting.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"content": "Practice selecting columns, filtering rows, and sorting results.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"video_url": "https://videos.example/sql/select-where-order",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_minutes": 30,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date('2026-02-25T10:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const EnrollmentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_at": new Date('2026-03-01T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_accessed_at": new Date('2026-03-10T07:50:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_at": new Date('2026-03-02T12:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 65,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_accessed_at": new Date('2026-03-10T08:30:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_at": new Date('2026-03-03T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_accessed_at": new Date('2026-03-09T16:10:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_at": new Date('2026-02-26T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-08T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 100,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_accessed_at": new Date('2026-03-08T17:05:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_at": new Date('2026-03-04T10:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_accessed_at": new Date('2026-03-04T10:20:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LessonProgressData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 100,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-01T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-01T09:35:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_viewed_at": new Date('2026-03-01T09:35:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_seconds": 1500,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 50,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-02T08:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_viewed_at": new Date('2026-03-10T07:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_seconds": 1200,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "not_started",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 100,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-02T12:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-02T13:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_viewed_at": new Date('2026-03-02T13:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_seconds": 1500,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 100,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-03T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-03T09:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_viewed_at": new Date('2026-03-03T09:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_seconds": 2400,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"progress_percent": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_viewed_at": new Date('2026-03-09T16:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_seconds": 0,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CourseAnnouncementsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Welcome to Modern Web Foundations",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Start with Lesson 1 and take notes on new terms.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"audience": "all",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_at": new Date('2026-03-01T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-15T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_pinned": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Office hours this Friday",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Live Q and A session for questions on HTML and CSS.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"audience": "all",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_at": new Date('2026-03-06T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-07T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_pinned": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Getting started checklist",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Make sure Node.js is installed and you can run a Next.js dev server.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"audience": "all",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_at": new Date('2026-03-03T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-20T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_pinned": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Practice queries included",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Download the practice dataset and try the exercises after each lesson.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"audience": "all",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_at": new Date('2026-02-26T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-30T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_pinned": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Short survey before Lesson 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Tell us your goals so the examples match your needs.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"audience": "all",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_at": new Date('2026-03-04T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-18T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_pinned": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LessonQuizzesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "HTML Semantics Check",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Answer the questions based on the lesson content.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passing_score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_limit_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_attempts": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Flexbox Fundamentals Quiz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Choose the best answer for each question.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passing_score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_limit_minutes": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_attempts": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Next.js Routing Quiz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Test your understanding of routes and layouts.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passing_score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_limit_minutes": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_attempts": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "SQL Basics Quiz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Work through simple query questions.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passing_score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_limit_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_attempts": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "DOM Events Quiz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Confirm understanding of event handling and DOM updates.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passing_score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_limit_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_attempts": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QuizQuestionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"prompt": "Which element best represents primary navigation links?",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"question_type": "multiple_choice",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"explanation": "Use the nav element for major navigation blocks.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"prompt": "True or false: Multiple h1 elements are always invalid.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"question_type": "multiple_choice",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"explanation": "It depends on document structure; multiple h1 can be valid in sections.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"prompt": "Which property controls alignment on the cross axis?",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"question_type": "short_answer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"explanation": "align-items controls cross-axis alignment.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"prompt": "In the app router, where do shared layouts live?",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"question_type": "true_false",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"explanation": "Layouts are defined with layout files alongside routes.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"prompt": "What clause filters rows returned by a SELECT query?",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"question_type": "true_false",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"explanation": "WHERE filters rows based on conditions.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QuizAnswerChoicesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"choice_text": "nav",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_correct": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"choice_text": "header",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_correct": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 2,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"choice_text": "section",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_correct": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"choice_text": "align-items",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_correct": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"choice_text": "WHERE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_correct": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_index": 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QuizAttemptsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "graded",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-01T09:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-03-01T09:48:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 80,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passed": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-02T13:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-03-02T13:18:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 90,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passed": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "submitted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-10T07:55:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-03-31T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passed": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-01T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-03-01T10:08:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passed": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-03-09T16:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-03-09T16:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 60,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"passed": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCoursWithInstructor() {
|
|
|
|
const relatedInstructor0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cours0 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Cours0?.setInstructor)
|
|
{
|
|
await
|
|
Cours0.
|
|
setInstructor(relatedInstructor0);
|
|
}
|
|
|
|
const relatedInstructor1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cours1 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Cours1?.setInstructor)
|
|
{
|
|
await
|
|
Cours1.
|
|
setInstructor(relatedInstructor1);
|
|
}
|
|
|
|
const relatedInstructor2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cours2 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Cours2?.setInstructor)
|
|
{
|
|
await
|
|
Cours2.
|
|
setInstructor(relatedInstructor2);
|
|
}
|
|
|
|
const relatedInstructor3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cours3 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Cours3?.setInstructor)
|
|
{
|
|
await
|
|
Cours3.
|
|
setInstructor(relatedInstructor3);
|
|
}
|
|
|
|
const relatedInstructor4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cours4 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Cours4?.setInstructor)
|
|
{
|
|
await
|
|
Cours4.
|
|
setInstructor(relatedInstructor4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLessonWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Lesson0 = await Lessons.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lesson0?.setCourse)
|
|
{
|
|
await
|
|
Lesson0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Lesson1 = await Lessons.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lesson1?.setCourse)
|
|
{
|
|
await
|
|
Lesson1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Lesson2 = await Lessons.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lesson2?.setCourse)
|
|
{
|
|
await
|
|
Lesson2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Lesson3 = await Lessons.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Lesson3?.setCourse)
|
|
{
|
|
await
|
|
Lesson3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Lesson4 = await Lessons.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Lesson4?.setCourse)
|
|
{
|
|
await
|
|
Lesson4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateEnrollmentWithStudent() {
|
|
|
|
const relatedStudent0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Enrollment0 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Enrollment0?.setStudent)
|
|
{
|
|
await
|
|
Enrollment0.
|
|
setStudent(relatedStudent0);
|
|
}
|
|
|
|
const relatedStudent1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Enrollment1 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Enrollment1?.setStudent)
|
|
{
|
|
await
|
|
Enrollment1.
|
|
setStudent(relatedStudent1);
|
|
}
|
|
|
|
const relatedStudent2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Enrollment2 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Enrollment2?.setStudent)
|
|
{
|
|
await
|
|
Enrollment2.
|
|
setStudent(relatedStudent2);
|
|
}
|
|
|
|
const relatedStudent3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Enrollment3 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Enrollment3?.setStudent)
|
|
{
|
|
await
|
|
Enrollment3.
|
|
setStudent(relatedStudent3);
|
|
}
|
|
|
|
const relatedStudent4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Enrollment4 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Enrollment4?.setStudent)
|
|
{
|
|
await
|
|
Enrollment4.
|
|
setStudent(relatedStudent4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateEnrollmentWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Enrollment0 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Enrollment0?.setCourse)
|
|
{
|
|
await
|
|
Enrollment0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Enrollment1 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Enrollment1?.setCourse)
|
|
{
|
|
await
|
|
Enrollment1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Enrollment2 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Enrollment2?.setCourse)
|
|
{
|
|
await
|
|
Enrollment2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Enrollment3 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Enrollment3?.setCourse)
|
|
{
|
|
await
|
|
Enrollment3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Enrollment4 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Enrollment4?.setCourse)
|
|
{
|
|
await
|
|
Enrollment4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLessonProgresWithEnrollment() {
|
|
|
|
const relatedEnrollment0 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const LessonProgres0 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LessonProgres0?.setEnrollment)
|
|
{
|
|
await
|
|
LessonProgres0.
|
|
setEnrollment(relatedEnrollment0);
|
|
}
|
|
|
|
const relatedEnrollment1 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const LessonProgres1 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LessonProgres1?.setEnrollment)
|
|
{
|
|
await
|
|
LessonProgres1.
|
|
setEnrollment(relatedEnrollment1);
|
|
}
|
|
|
|
const relatedEnrollment2 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const LessonProgres2 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LessonProgres2?.setEnrollment)
|
|
{
|
|
await
|
|
LessonProgres2.
|
|
setEnrollment(relatedEnrollment2);
|
|
}
|
|
|
|
const relatedEnrollment3 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const LessonProgres3 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (LessonProgres3?.setEnrollment)
|
|
{
|
|
await
|
|
LessonProgres3.
|
|
setEnrollment(relatedEnrollment3);
|
|
}
|
|
|
|
const relatedEnrollment4 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const LessonProgres4 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (LessonProgres4?.setEnrollment)
|
|
{
|
|
await
|
|
LessonProgres4.
|
|
setEnrollment(relatedEnrollment4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateLessonProgresWithLesson() {
|
|
|
|
const relatedLesson0 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonProgres0 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LessonProgres0?.setLesson)
|
|
{
|
|
await
|
|
LessonProgres0.
|
|
setLesson(relatedLesson0);
|
|
}
|
|
|
|
const relatedLesson1 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonProgres1 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LessonProgres1?.setLesson)
|
|
{
|
|
await
|
|
LessonProgres1.
|
|
setLesson(relatedLesson1);
|
|
}
|
|
|
|
const relatedLesson2 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonProgres2 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LessonProgres2?.setLesson)
|
|
{
|
|
await
|
|
LessonProgres2.
|
|
setLesson(relatedLesson2);
|
|
}
|
|
|
|
const relatedLesson3 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonProgres3 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (LessonProgres3?.setLesson)
|
|
{
|
|
await
|
|
LessonProgres3.
|
|
setLesson(relatedLesson3);
|
|
}
|
|
|
|
const relatedLesson4 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonProgres4 = await LessonProgress.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (LessonProgres4?.setLesson)
|
|
{
|
|
await
|
|
LessonProgres4.
|
|
setLesson(relatedLesson4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCourseAnnouncementWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const CourseAnnouncement0 = await CourseAnnouncements.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CourseAnnouncement0?.setCourse)
|
|
{
|
|
await
|
|
CourseAnnouncement0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const CourseAnnouncement1 = await CourseAnnouncements.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CourseAnnouncement1?.setCourse)
|
|
{
|
|
await
|
|
CourseAnnouncement1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const CourseAnnouncement2 = await CourseAnnouncements.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CourseAnnouncement2?.setCourse)
|
|
{
|
|
await
|
|
CourseAnnouncement2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const CourseAnnouncement3 = await CourseAnnouncements.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CourseAnnouncement3?.setCourse)
|
|
{
|
|
await
|
|
CourseAnnouncement3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const CourseAnnouncement4 = await CourseAnnouncements.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (CourseAnnouncement4?.setCourse)
|
|
{
|
|
await
|
|
CourseAnnouncement4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLessonQuizzeWithLesson() {
|
|
|
|
const relatedLesson0 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonQuizze0 = await LessonQuizzes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LessonQuizze0?.setLesson)
|
|
{
|
|
await
|
|
LessonQuizze0.
|
|
setLesson(relatedLesson0);
|
|
}
|
|
|
|
const relatedLesson1 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonQuizze1 = await LessonQuizzes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LessonQuizze1?.setLesson)
|
|
{
|
|
await
|
|
LessonQuizze1.
|
|
setLesson(relatedLesson1);
|
|
}
|
|
|
|
const relatedLesson2 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonQuizze2 = await LessonQuizzes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LessonQuizze2?.setLesson)
|
|
{
|
|
await
|
|
LessonQuizze2.
|
|
setLesson(relatedLesson2);
|
|
}
|
|
|
|
const relatedLesson3 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonQuizze3 = await LessonQuizzes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (LessonQuizze3?.setLesson)
|
|
{
|
|
await
|
|
LessonQuizze3.
|
|
setLesson(relatedLesson3);
|
|
}
|
|
|
|
const relatedLesson4 = await Lessons.findOne({
|
|
offset: Math.floor(Math.random() * (await Lessons.count())),
|
|
});
|
|
const LessonQuizze4 = await LessonQuizzes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (LessonQuizze4?.setLesson)
|
|
{
|
|
await
|
|
LessonQuizze4.
|
|
setLesson(relatedLesson4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuizQuestionWithQuiz() {
|
|
|
|
const relatedQuiz0 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizQuestion0 = await QuizQuestions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuizQuestion0?.setQuiz)
|
|
{
|
|
await
|
|
QuizQuestion0.
|
|
setQuiz(relatedQuiz0);
|
|
}
|
|
|
|
const relatedQuiz1 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizQuestion1 = await QuizQuestions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuizQuestion1?.setQuiz)
|
|
{
|
|
await
|
|
QuizQuestion1.
|
|
setQuiz(relatedQuiz1);
|
|
}
|
|
|
|
const relatedQuiz2 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizQuestion2 = await QuizQuestions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuizQuestion2?.setQuiz)
|
|
{
|
|
await
|
|
QuizQuestion2.
|
|
setQuiz(relatedQuiz2);
|
|
}
|
|
|
|
const relatedQuiz3 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizQuestion3 = await QuizQuestions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuizQuestion3?.setQuiz)
|
|
{
|
|
await
|
|
QuizQuestion3.
|
|
setQuiz(relatedQuiz3);
|
|
}
|
|
|
|
const relatedQuiz4 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizQuestion4 = await QuizQuestions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuizQuestion4?.setQuiz)
|
|
{
|
|
await
|
|
QuizQuestion4.
|
|
setQuiz(relatedQuiz4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuizAnswerChoiceWithQuestion() {
|
|
|
|
const relatedQuestion0 = await QuizQuestions.findOne({
|
|
offset: Math.floor(Math.random() * (await QuizQuestions.count())),
|
|
});
|
|
const QuizAnswerChoice0 = await QuizAnswerChoices.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuizAnswerChoice0?.setQuestion)
|
|
{
|
|
await
|
|
QuizAnswerChoice0.
|
|
setQuestion(relatedQuestion0);
|
|
}
|
|
|
|
const relatedQuestion1 = await QuizQuestions.findOne({
|
|
offset: Math.floor(Math.random() * (await QuizQuestions.count())),
|
|
});
|
|
const QuizAnswerChoice1 = await QuizAnswerChoices.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuizAnswerChoice1?.setQuestion)
|
|
{
|
|
await
|
|
QuizAnswerChoice1.
|
|
setQuestion(relatedQuestion1);
|
|
}
|
|
|
|
const relatedQuestion2 = await QuizQuestions.findOne({
|
|
offset: Math.floor(Math.random() * (await QuizQuestions.count())),
|
|
});
|
|
const QuizAnswerChoice2 = await QuizAnswerChoices.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuizAnswerChoice2?.setQuestion)
|
|
{
|
|
await
|
|
QuizAnswerChoice2.
|
|
setQuestion(relatedQuestion2);
|
|
}
|
|
|
|
const relatedQuestion3 = await QuizQuestions.findOne({
|
|
offset: Math.floor(Math.random() * (await QuizQuestions.count())),
|
|
});
|
|
const QuizAnswerChoice3 = await QuizAnswerChoices.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuizAnswerChoice3?.setQuestion)
|
|
{
|
|
await
|
|
QuizAnswerChoice3.
|
|
setQuestion(relatedQuestion3);
|
|
}
|
|
|
|
const relatedQuestion4 = await QuizQuestions.findOne({
|
|
offset: Math.floor(Math.random() * (await QuizQuestions.count())),
|
|
});
|
|
const QuizAnswerChoice4 = await QuizAnswerChoices.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuizAnswerChoice4?.setQuestion)
|
|
{
|
|
await
|
|
QuizAnswerChoice4.
|
|
setQuestion(relatedQuestion4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuizAttemptWithQuiz() {
|
|
|
|
const relatedQuiz0 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizAttempt0 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuizAttempt0?.setQuiz)
|
|
{
|
|
await
|
|
QuizAttempt0.
|
|
setQuiz(relatedQuiz0);
|
|
}
|
|
|
|
const relatedQuiz1 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizAttempt1 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuizAttempt1?.setQuiz)
|
|
{
|
|
await
|
|
QuizAttempt1.
|
|
setQuiz(relatedQuiz1);
|
|
}
|
|
|
|
const relatedQuiz2 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizAttempt2 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuizAttempt2?.setQuiz)
|
|
{
|
|
await
|
|
QuizAttempt2.
|
|
setQuiz(relatedQuiz2);
|
|
}
|
|
|
|
const relatedQuiz3 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizAttempt3 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuizAttempt3?.setQuiz)
|
|
{
|
|
await
|
|
QuizAttempt3.
|
|
setQuiz(relatedQuiz3);
|
|
}
|
|
|
|
const relatedQuiz4 = await LessonQuizzes.findOne({
|
|
offset: Math.floor(Math.random() * (await LessonQuizzes.count())),
|
|
});
|
|
const QuizAttempt4 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuizAttempt4?.setQuiz)
|
|
{
|
|
await
|
|
QuizAttempt4.
|
|
setQuiz(relatedQuiz4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQuizAttemptWithStudent() {
|
|
|
|
const relatedStudent0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QuizAttempt0 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuizAttempt0?.setStudent)
|
|
{
|
|
await
|
|
QuizAttempt0.
|
|
setStudent(relatedStudent0);
|
|
}
|
|
|
|
const relatedStudent1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QuizAttempt1 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuizAttempt1?.setStudent)
|
|
{
|
|
await
|
|
QuizAttempt1.
|
|
setStudent(relatedStudent1);
|
|
}
|
|
|
|
const relatedStudent2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QuizAttempt2 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuizAttempt2?.setStudent)
|
|
{
|
|
await
|
|
QuizAttempt2.
|
|
setStudent(relatedStudent2);
|
|
}
|
|
|
|
const relatedStudent3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QuizAttempt3 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuizAttempt3?.setStudent)
|
|
{
|
|
await
|
|
QuizAttempt3.
|
|
setStudent(relatedStudent3);
|
|
}
|
|
|
|
const relatedStudent4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QuizAttempt4 = await QuizAttempts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuizAttempt4?.setStudent)
|
|
{
|
|
await
|
|
QuizAttempt4.
|
|
setStudent(relatedStudent4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Courses.bulkCreate(CoursesData);
|
|
|
|
|
|
|
|
|
|
await CourseCategories.bulkCreate(CourseCategoriesData);
|
|
|
|
|
|
|
|
|
|
await Lessons.bulkCreate(LessonsData);
|
|
|
|
|
|
|
|
|
|
await Enrollments.bulkCreate(EnrollmentsData);
|
|
|
|
|
|
|
|
|
|
await LessonProgress.bulkCreate(LessonProgressData);
|
|
|
|
|
|
|
|
|
|
await CourseAnnouncements.bulkCreate(CourseAnnouncementsData);
|
|
|
|
|
|
|
|
|
|
await LessonQuizzes.bulkCreate(LessonQuizzesData);
|
|
|
|
|
|
|
|
|
|
await QuizQuestions.bulkCreate(QuizQuestionsData);
|
|
|
|
|
|
|
|
|
|
await QuizAnswerChoices.bulkCreate(QuizAnswerChoicesData);
|
|
|
|
|
|
|
|
|
|
await QuizAttempts.bulkCreate(QuizAttemptsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCoursWithInstructor(),
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLessonWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateEnrollmentWithStudent(),
|
|
|
|
|
|
|
|
|
|
await associateEnrollmentWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLessonProgresWithEnrollment(),
|
|
|
|
|
|
|
|
|
|
await associateLessonProgresWithLesson(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCourseAnnouncementWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLessonQuizzeWithLesson(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuizQuestionWithQuiz(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuizAnswerChoiceWithQuestion(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuizAttemptWithQuiz(),
|
|
|
|
|
|
|
|
|
|
await associateQuizAttemptWithStudent(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('courses', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('course_categories', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('lessons', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('enrollments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('lesson_progress', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('course_announcements', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('lesson_quizzes', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('quiz_questions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('quiz_answer_choices', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('quiz_attempts', null, {});
|
|
|
|
|
|
},
|
|
}; |