4130 lines
82 KiB
JavaScript
4130 lines
82 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Students = db.students;
|
|
|
|
const Teachers = db.teachers;
|
|
|
|
const Subjects = db.subjects;
|
|
|
|
const Courses = db.courses;
|
|
|
|
const Classrooms = db.classrooms;
|
|
|
|
const Enrollments = db.enrollments;
|
|
|
|
const Grades = db.grades;
|
|
|
|
const Attendances = db.attendances;
|
|
|
|
const Schedules = db.schedules;
|
|
|
|
const Exams = db.exams;
|
|
|
|
const Assignments = db.assignments;
|
|
|
|
const Guardians = db.guardians;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const StudentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"student_number": "S2026-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dob": new Date('2008-04-12T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "12 Oak Street, Springfield",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"student_number": "S2026-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dob": new Date('2009-09-03T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "45 Pine Avenue, Springfield",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"student_number": "S2026-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dob": new Date('2008-12-22T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "male",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "7 River Road, Springfield",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"student_number": "S2026-004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dob": new Date('2009-02-05T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "99 Elm Street, Springfield",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"student_number": "S2026-005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dob": new Date('2008-07-18T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "male",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "23 Maple Lane, Springfield",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TeachersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"teacher_number": "T2026-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bio": "Senior mathematics teacher with 8 years experience",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"teacher_number": "T2026-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bio": "Physics teacher and lab coordinator",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"teacher_number": "T2026-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bio": "English teacher and curriculum lead",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"teacher_number": "T2026-004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bio": "History teacher focusing on modern history",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"teacher_number": "T2026-005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bio": "Computer science teacher and club advisor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SubjectsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "MATH101",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Algebra I",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Foundational algebra topics including equations and inequalities",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"credits": 4,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "CS102",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Introduction to Programming",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Basic programming concepts using Python",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"credits": 4,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "PHYS110",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "General Physics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Mechanics and waves with practical labs",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"credits": 4,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "ENG201",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "English Literature",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Study of classic and modern English works",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"credits": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "HIST150",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "World History",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Survey of major world events from 1900 to present",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"credits": 3,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CoursesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "C-MATH101-A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Algebra I - Section A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 30,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "C-CS102-A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Intro to Programming - Lab",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 24,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "C-PHYS110-A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "General Physics - Section A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 28,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "C-ENG201-A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "English Literature - Section A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 26,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "C-HIST150-A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "World History - Section A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 32,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ClassroomsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Room 101",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Main Building Floor 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 30,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Computer Lab 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Tech Wing Floor 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 24,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Physics Lab",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Science Block Floor 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 28,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Room 204",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Main Building Floor 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 26,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Lecture Hall A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Auditorium Ground Floor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity": 60,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const EnrollmentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"enrollment_code": "E2026-0001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "enrolled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_on": new Date('2026-01-10T09:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"enrollment_code": "E2026-0002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_on": new Date('2026-01-11T10:15:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"enrollment_code": "E2026-0003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "enrolled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_on": new Date('2026-01-12T11:20:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"enrollment_code": "E2026-0004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "dropped",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_on": new Date('2026-01-13T08:30:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"enrollment_code": "E2026-0005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "dropped",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"enrolled_on": new Date('2026-01-14T14:45:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const GradesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Algebra Midterm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value": 88.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grade_type": "quiz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recorded_on": new Date('2026-03-15T12:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Programming Assignment 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value": 92.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grade_type": "assignment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recorded_on": new Date('2026-02-20T09:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Physics Lab Report",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value": 79.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grade_type": "assignment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recorded_on": new Date('2026-03-01T15:30:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "English Essay",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value": 85.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grade_type": "final",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recorded_on": new Date('2026-04-02T10:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "History Quiz 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value": 91.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grade_type": "final",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recorded_on": new Date('2026-02-28T08:45:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AttendancesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"date": new Date('2026-01-20T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "late",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"note": "On time",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"date": new Date('2026-01-20T10:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "late",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"note": "Arrived 10 minutes late",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"date": new Date('2026-01-20T11:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "present",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"note": "Sick",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"date": new Date('2026-01-20T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "late",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"note": "Present",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"date": new Date('2026-01-20T14:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "absent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"note": "Medical appointment",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SchedulesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-02-01T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-02-01T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Algebra weekly lecture Mondays and Wednesdays",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-02-02T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-02-02T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Programming lab sessions weekly on Tuesdays",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-02-03T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-02-03T12:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Physics lab schedule",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-02-01T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-02-01T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "English literature discussion group",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-02-01T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-02-01T15:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "History weekly lecture",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ExamsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Algebra Final Exam",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-06-10T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-06-10T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_score": 100,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Programming Final Project Presentation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-06-12T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-06-12T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_score": 100,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Physics Final Lab Exam",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-06-11T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-06-11T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_score": 100,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "English Final Essay",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-06-09T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-06-09T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_score": 100,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "History Final Exam",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start": new Date('2026-06-13T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end": new Date('2026-06-13T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_score": 100,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AssignmentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Homework Week 3",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Practice problems on linear equations and factoring",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-02-10T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "submitted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Project Proposal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Submit a short proposal describing your project idea",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-03-01T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "assigned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Lab Report 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Document results from mechanics experiment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-02-20T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "graded",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Reading Response",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Write a 500 word response to the assigned reading",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-02-14T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "History Source Analysis",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Analyze primary sources provided in class",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-03-05T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const GuardiansData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"parent_name": "Eva Johnson",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+1-555-0101",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"parent_name": "Isla Green",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+1-555-0102",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"parent_name": "Nora Patel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+1-555-0103",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"parent_name": "Omar Ali",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+1-555-0104",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"parent_name": "Paul Young",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+1-555-0105",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateStudentWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Student0 = await Students.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Student0?.setUser)
|
|
{
|
|
await
|
|
Student0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Student1 = await Students.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Student1?.setUser)
|
|
{
|
|
await
|
|
Student1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Student2 = await Students.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Student2?.setUser)
|
|
{
|
|
await
|
|
Student2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Student3 = await Students.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Student3?.setUser)
|
|
{
|
|
await
|
|
Student3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Student4 = await Students.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Student4?.setUser)
|
|
{
|
|
await
|
|
Student4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTeacherWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Teacher0 = await Teachers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Teacher0?.setUser)
|
|
{
|
|
await
|
|
Teacher0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Teacher1 = await Teachers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Teacher1?.setUser)
|
|
{
|
|
await
|
|
Teacher1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Teacher2 = await Teachers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Teacher2?.setUser)
|
|
{
|
|
await
|
|
Teacher2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Teacher3 = await Teachers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Teacher3?.setUser)
|
|
{
|
|
await
|
|
Teacher3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Teacher4 = await Teachers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Teacher4?.setUser)
|
|
{
|
|
await
|
|
Teacher4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCoursWithSubject() {
|
|
|
|
const relatedSubject0 = await Subjects.findOne({
|
|
offset: Math.floor(Math.random() * (await Subjects.count())),
|
|
});
|
|
const Cours0 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Cours0?.setSubject)
|
|
{
|
|
await
|
|
Cours0.
|
|
setSubject(relatedSubject0);
|
|
}
|
|
|
|
const relatedSubject1 = await Subjects.findOne({
|
|
offset: Math.floor(Math.random() * (await Subjects.count())),
|
|
});
|
|
const Cours1 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Cours1?.setSubject)
|
|
{
|
|
await
|
|
Cours1.
|
|
setSubject(relatedSubject1);
|
|
}
|
|
|
|
const relatedSubject2 = await Subjects.findOne({
|
|
offset: Math.floor(Math.random() * (await Subjects.count())),
|
|
});
|
|
const Cours2 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Cours2?.setSubject)
|
|
{
|
|
await
|
|
Cours2.
|
|
setSubject(relatedSubject2);
|
|
}
|
|
|
|
const relatedSubject3 = await Subjects.findOne({
|
|
offset: Math.floor(Math.random() * (await Subjects.count())),
|
|
});
|
|
const Cours3 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Cours3?.setSubject)
|
|
{
|
|
await
|
|
Cours3.
|
|
setSubject(relatedSubject3);
|
|
}
|
|
|
|
const relatedSubject4 = await Subjects.findOne({
|
|
offset: Math.floor(Math.random() * (await Subjects.count())),
|
|
});
|
|
const Cours4 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Cours4?.setSubject)
|
|
{
|
|
await
|
|
Cours4.
|
|
setSubject(relatedSubject4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateCoursWithTeacher() {
|
|
|
|
const relatedTeacher0 = await Teachers.findOne({
|
|
offset: Math.floor(Math.random() * (await Teachers.count())),
|
|
});
|
|
const Cours0 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Cours0?.setTeacher)
|
|
{
|
|
await
|
|
Cours0.
|
|
setTeacher(relatedTeacher0);
|
|
}
|
|
|
|
const relatedTeacher1 = await Teachers.findOne({
|
|
offset: Math.floor(Math.random() * (await Teachers.count())),
|
|
});
|
|
const Cours1 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Cours1?.setTeacher)
|
|
{
|
|
await
|
|
Cours1.
|
|
setTeacher(relatedTeacher1);
|
|
}
|
|
|
|
const relatedTeacher2 = await Teachers.findOne({
|
|
offset: Math.floor(Math.random() * (await Teachers.count())),
|
|
});
|
|
const Cours2 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Cours2?.setTeacher)
|
|
{
|
|
await
|
|
Cours2.
|
|
setTeacher(relatedTeacher2);
|
|
}
|
|
|
|
const relatedTeacher3 = await Teachers.findOne({
|
|
offset: Math.floor(Math.random() * (await Teachers.count())),
|
|
});
|
|
const Cours3 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Cours3?.setTeacher)
|
|
{
|
|
await
|
|
Cours3.
|
|
setTeacher(relatedTeacher3);
|
|
}
|
|
|
|
const relatedTeacher4 = await Teachers.findOne({
|
|
offset: Math.floor(Math.random() * (await Teachers.count())),
|
|
});
|
|
const Cours4 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Cours4?.setTeacher)
|
|
{
|
|
await
|
|
Cours4.
|
|
setTeacher(relatedTeacher4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateCoursWithClassroom() {
|
|
|
|
const relatedClassroom0 = await Classrooms.findOne({
|
|
offset: Math.floor(Math.random() * (await Classrooms.count())),
|
|
});
|
|
const Cours0 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Cours0?.setClassroom)
|
|
{
|
|
await
|
|
Cours0.
|
|
setClassroom(relatedClassroom0);
|
|
}
|
|
|
|
const relatedClassroom1 = await Classrooms.findOne({
|
|
offset: Math.floor(Math.random() * (await Classrooms.count())),
|
|
});
|
|
const Cours1 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Cours1?.setClassroom)
|
|
{
|
|
await
|
|
Cours1.
|
|
setClassroom(relatedClassroom1);
|
|
}
|
|
|
|
const relatedClassroom2 = await Classrooms.findOne({
|
|
offset: Math.floor(Math.random() * (await Classrooms.count())),
|
|
});
|
|
const Cours2 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Cours2?.setClassroom)
|
|
{
|
|
await
|
|
Cours2.
|
|
setClassroom(relatedClassroom2);
|
|
}
|
|
|
|
const relatedClassroom3 = await Classrooms.findOne({
|
|
offset: Math.floor(Math.random() * (await Classrooms.count())),
|
|
});
|
|
const Cours3 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Cours3?.setClassroom)
|
|
{
|
|
await
|
|
Cours3.
|
|
setClassroom(relatedClassroom3);
|
|
}
|
|
|
|
const relatedClassroom4 = await Classrooms.findOne({
|
|
offset: Math.floor(Math.random() * (await Classrooms.count())),
|
|
});
|
|
const Cours4 = await Courses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Cours4?.setClassroom)
|
|
{
|
|
await
|
|
Cours4.
|
|
setClassroom(relatedClassroom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateEnrollmentWithStudent() {
|
|
|
|
const relatedStudent0 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Enrollment0 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Enrollment0?.setStudent)
|
|
{
|
|
await
|
|
Enrollment0.
|
|
setStudent(relatedStudent0);
|
|
}
|
|
|
|
const relatedStudent1 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Enrollment1 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Enrollment1?.setStudent)
|
|
{
|
|
await
|
|
Enrollment1.
|
|
setStudent(relatedStudent1);
|
|
}
|
|
|
|
const relatedStudent2 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Enrollment2 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Enrollment2?.setStudent)
|
|
{
|
|
await
|
|
Enrollment2.
|
|
setStudent(relatedStudent2);
|
|
}
|
|
|
|
const relatedStudent3 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Enrollment3 = await Enrollments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Enrollment3?.setStudent)
|
|
{
|
|
await
|
|
Enrollment3.
|
|
setStudent(relatedStudent3);
|
|
}
|
|
|
|
const relatedStudent4 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.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 associateGradeWithEnrollment() {
|
|
|
|
const relatedEnrollment0 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const Grade0 = await Grades.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Grade0?.setEnrollment)
|
|
{
|
|
await
|
|
Grade0.
|
|
setEnrollment(relatedEnrollment0);
|
|
}
|
|
|
|
const relatedEnrollment1 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const Grade1 = await Grades.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Grade1?.setEnrollment)
|
|
{
|
|
await
|
|
Grade1.
|
|
setEnrollment(relatedEnrollment1);
|
|
}
|
|
|
|
const relatedEnrollment2 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const Grade2 = await Grades.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Grade2?.setEnrollment)
|
|
{
|
|
await
|
|
Grade2.
|
|
setEnrollment(relatedEnrollment2);
|
|
}
|
|
|
|
const relatedEnrollment3 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const Grade3 = await Grades.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Grade3?.setEnrollment)
|
|
{
|
|
await
|
|
Grade3.
|
|
setEnrollment(relatedEnrollment3);
|
|
}
|
|
|
|
const relatedEnrollment4 = await Enrollments.findOne({
|
|
offset: Math.floor(Math.random() * (await Enrollments.count())),
|
|
});
|
|
const Grade4 = await Grades.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Grade4?.setEnrollment)
|
|
{
|
|
await
|
|
Grade4.
|
|
setEnrollment(relatedEnrollment4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAttendanceWithStudent() {
|
|
|
|
const relatedStudent0 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Attendance0 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Attendance0?.setStudent)
|
|
{
|
|
await
|
|
Attendance0.
|
|
setStudent(relatedStudent0);
|
|
}
|
|
|
|
const relatedStudent1 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Attendance1 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Attendance1?.setStudent)
|
|
{
|
|
await
|
|
Attendance1.
|
|
setStudent(relatedStudent1);
|
|
}
|
|
|
|
const relatedStudent2 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Attendance2 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Attendance2?.setStudent)
|
|
{
|
|
await
|
|
Attendance2.
|
|
setStudent(relatedStudent2);
|
|
}
|
|
|
|
const relatedStudent3 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Attendance3 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Attendance3?.setStudent)
|
|
{
|
|
await
|
|
Attendance3.
|
|
setStudent(relatedStudent3);
|
|
}
|
|
|
|
const relatedStudent4 = await Students.findOne({
|
|
offset: Math.floor(Math.random() * (await Students.count())),
|
|
});
|
|
const Attendance4 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Attendance4?.setStudent)
|
|
{
|
|
await
|
|
Attendance4.
|
|
setStudent(relatedStudent4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAttendanceWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Attendance0 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Attendance0?.setCourse)
|
|
{
|
|
await
|
|
Attendance0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Attendance1 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Attendance1?.setCourse)
|
|
{
|
|
await
|
|
Attendance1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Attendance2 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Attendance2?.setCourse)
|
|
{
|
|
await
|
|
Attendance2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Attendance3 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Attendance3?.setCourse)
|
|
{
|
|
await
|
|
Attendance3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Attendance4 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Attendance4?.setCourse)
|
|
{
|
|
await
|
|
Attendance4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAttendanceWithRecorded_by() {
|
|
|
|
const relatedRecorded_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Attendance0 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Attendance0?.setRecorded_by)
|
|
{
|
|
await
|
|
Attendance0.
|
|
setRecorded_by(relatedRecorded_by0);
|
|
}
|
|
|
|
const relatedRecorded_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Attendance1 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Attendance1?.setRecorded_by)
|
|
{
|
|
await
|
|
Attendance1.
|
|
setRecorded_by(relatedRecorded_by1);
|
|
}
|
|
|
|
const relatedRecorded_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Attendance2 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Attendance2?.setRecorded_by)
|
|
{
|
|
await
|
|
Attendance2.
|
|
setRecorded_by(relatedRecorded_by2);
|
|
}
|
|
|
|
const relatedRecorded_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Attendance3 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Attendance3?.setRecorded_by)
|
|
{
|
|
await
|
|
Attendance3.
|
|
setRecorded_by(relatedRecorded_by3);
|
|
}
|
|
|
|
const relatedRecorded_by4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Attendance4 = await Attendances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Attendance4?.setRecorded_by)
|
|
{
|
|
await
|
|
Attendance4.
|
|
setRecorded_by(relatedRecorded_by4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateScheduleWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Schedule0 = await Schedules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Schedule0?.setCourse)
|
|
{
|
|
await
|
|
Schedule0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Schedule1 = await Schedules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Schedule1?.setCourse)
|
|
{
|
|
await
|
|
Schedule1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Schedule2 = await Schedules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Schedule2?.setCourse)
|
|
{
|
|
await
|
|
Schedule2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Schedule3 = await Schedules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Schedule3?.setCourse)
|
|
{
|
|
await
|
|
Schedule3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Schedule4 = await Schedules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Schedule4?.setCourse)
|
|
{
|
|
await
|
|
Schedule4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateExamWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Exam0 = await Exams.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Exam0?.setCourse)
|
|
{
|
|
await
|
|
Exam0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Exam1 = await Exams.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Exam1?.setCourse)
|
|
{
|
|
await
|
|
Exam1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Exam2 = await Exams.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Exam2?.setCourse)
|
|
{
|
|
await
|
|
Exam2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Exam3 = await Exams.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Exam3?.setCourse)
|
|
{
|
|
await
|
|
Exam3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Exam4 = await Exams.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Exam4?.setCourse)
|
|
{
|
|
await
|
|
Exam4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAssignmentWithCourse() {
|
|
|
|
const relatedCourse0 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Assignment0 = await Assignments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Assignment0?.setCourse)
|
|
{
|
|
await
|
|
Assignment0.
|
|
setCourse(relatedCourse0);
|
|
}
|
|
|
|
const relatedCourse1 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Assignment1 = await Assignments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Assignment1?.setCourse)
|
|
{
|
|
await
|
|
Assignment1.
|
|
setCourse(relatedCourse1);
|
|
}
|
|
|
|
const relatedCourse2 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Assignment2 = await Assignments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Assignment2?.setCourse)
|
|
{
|
|
await
|
|
Assignment2.
|
|
setCourse(relatedCourse2);
|
|
}
|
|
|
|
const relatedCourse3 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Assignment3 = await Assignments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Assignment3?.setCourse)
|
|
{
|
|
await
|
|
Assignment3.
|
|
setCourse(relatedCourse3);
|
|
}
|
|
|
|
const relatedCourse4 = await Courses.findOne({
|
|
offset: Math.floor(Math.random() * (await Courses.count())),
|
|
});
|
|
const Assignment4 = await Assignments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Assignment4?.setCourse)
|
|
{
|
|
await
|
|
Assignment4.
|
|
setCourse(relatedCourse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateGuardianWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Guardian0 = await Guardians.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Guardian0?.setUser)
|
|
{
|
|
await
|
|
Guardian0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Guardian1 = await Guardians.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Guardian1?.setUser)
|
|
{
|
|
await
|
|
Guardian1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Guardian2 = await Guardians.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Guardian2?.setUser)
|
|
{
|
|
await
|
|
Guardian2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Guardian3 = await Guardians.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Guardian3?.setUser)
|
|
{
|
|
await
|
|
Guardian3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Guardian4 = await Guardians.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Guardian4?.setUser)
|
|
{
|
|
await
|
|
Guardian4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Students.bulkCreate(StudentsData);
|
|
|
|
|
|
|
|
|
|
await Teachers.bulkCreate(TeachersData);
|
|
|
|
|
|
|
|
|
|
await Subjects.bulkCreate(SubjectsData);
|
|
|
|
|
|
|
|
|
|
await Courses.bulkCreate(CoursesData);
|
|
|
|
|
|
|
|
|
|
await Classrooms.bulkCreate(ClassroomsData);
|
|
|
|
|
|
|
|
|
|
await Enrollments.bulkCreate(EnrollmentsData);
|
|
|
|
|
|
|
|
|
|
await Grades.bulkCreate(GradesData);
|
|
|
|
|
|
|
|
|
|
await Attendances.bulkCreate(AttendancesData);
|
|
|
|
|
|
|
|
|
|
await Schedules.bulkCreate(SchedulesData);
|
|
|
|
|
|
|
|
|
|
await Exams.bulkCreate(ExamsData);
|
|
|
|
|
|
|
|
|
|
await Assignments.bulkCreate(AssignmentsData);
|
|
|
|
|
|
|
|
|
|
await Guardians.bulkCreate(GuardiansData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateStudentWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTeacherWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCoursWithSubject(),
|
|
|
|
|
|
|
|
|
|
await associateCoursWithTeacher(),
|
|
|
|
|
|
|
|
|
|
await associateCoursWithClassroom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateEnrollmentWithStudent(),
|
|
|
|
|
|
|
|
|
|
await associateEnrollmentWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateGradeWithEnrollment(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAttendanceWithStudent(),
|
|
|
|
|
|
|
|
|
|
await associateAttendanceWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAttendanceWithRecorded_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateScheduleWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateExamWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAssignmentWithCourse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateGuardianWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('students', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('teachers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('subjects', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('courses', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('classrooms', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('enrollments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('grades', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('attendances', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('schedules', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('exams', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('assignments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('guardians', null, {});
|
|
|
|
|
|
},
|
|
}; |