39561-vm/backend/src/db/seeders/20231127130745-sample-data.js
2026-04-11 16:18:51 +00:00

11870 lines
272 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const Schools = db.schools;
const GradeLevels = db.grade_levels;
const Subjects = db.subjects;
const Classrooms = db.classrooms;
const ClassroomMemberships = db.classroom_memberships;
const TeachingAssignments = db.teaching_assignments;
const Homeworks = db.homeworks;
const HomeworkRubrics = db.homework_rubrics;
const HomeworkExtensions = db.homework_extensions;
const HomeworkSubmissions = db.homework_submissions;
const SubmissionGrades = db.submission_grades;
const RubricScores = db.rubric_scores;
const Gradebooks = db.gradebooks;
const GradebookColumns = db.gradebook_columns;
const GradebookEntries = db.gradebook_entries;
const AdviserReports = db.adviser_reports;
const Announcements = db.announcements;
const Notifications = db.notifications;
const AccountApplications = db.account_applications;
const Guardians = db.guardians;
const SecurityEvents = db.security_events;
const SupportSettings = db.support_settings;
const FeedbackItems = db.feedback_items;
const Events = db.events;
const AiMonitoringRules = db.ai_monitoring_rules;
const SchoolsData = [
{
"name": "Ada Lovelace",
},
{
"name": "Marie Curie",
},
{
"name": "Ada Lovelace",
},
{
"name": "Ada Lovelace",
},
];
const GradeLevelsData = [
{
"grade_name": "Grade 7",
"grade_order": 7,
// type code here for "relation_one" field
"is_active": true,
},
{
"grade_name": "Grade 8",
"grade_order": 8,
// type code here for "relation_one" field
"is_active": true,
},
{
"grade_name": "Grade 9",
"grade_order": 9,
// type code here for "relation_one" field
"is_active": true,
},
{
"grade_name": "Grade 10",
"grade_order": 10,
// type code here for "relation_one" field
"is_active": true,
},
];
const SubjectsData = [
{
"subject_name": "Mathematics",
"subject_code": "MATH-7",
// type code here for "relation_one" field
// type code here for "relation_one" field
"description": "Core math covering integers, fractions, and basic algebra.",
"is_active": true,
},
{
"subject_name": "English Language Arts",
"subject_code": "ELA-7",
// type code here for "relation_one" field
// type code here for "relation_one" field
"description": "Reading comprehension, writing fundamentals, and vocabulary development.",
"is_active": true,
},
{
"subject_name": "General Science",
"subject_code": "SCI-8",
// type code here for "relation_one" field
// type code here for "relation_one" field
"description": "Life science, earth science, and introductory lab skills.",
"is_active": true,
},
{
"subject_name": "Computer Science",
"subject_code": "CS-10",
// type code here for "relation_one" field
// type code here for "relation_one" field
"description": "Programming basics, algorithms, and responsible technology use.",
"is_active": true,
},
];
const ClassroomsData = [
{
"classroom_name": "Grade 7 - Section A",
"section_name": "A",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"invite_code": "NB7A2026",
"invite_code_expires_at": new Date('2026-12-31T23:59:59Z'),
"invite_code_enabled": true,
"room_description": "Primary section for Grade 7 learners at Northbridge.",
"is_active": true,
},
{
"classroom_name": "Grade 7 - Section B",
"section_name": "B",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"invite_code": "NB7B2026",
"invite_code_expires_at": new Date('2026-12-31T23:59:59Z'),
"invite_code_enabled": true,
"room_description": "Second section for Grade 7 learners at Northbridge.",
"is_active": true,
},
{
"classroom_name": "Grade 8 - Section A",
"section_name": "A",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"invite_code": "NB8A2026",
"invite_code_expires_at": new Date('2026-12-31T23:59:59Z'),
"invite_code_enabled": true,
"room_description": "Grade 8 Section A with a focus on science projects.",
"is_active": true,
},
{
"classroom_name": "Grade 10 - STEM 1",
"section_name": "STEM 1",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"invite_code": "RS10STEM1",
"invite_code_expires_at": new Date('2026-12-31T23:59:59Z'),
"invite_code_enabled": true,
"room_description": "Riverside Grade 10 STEM cohort.",
"is_active": true,
},
];
const ClassroomMembershipsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"joined_at": new Date('2026-03-05T09:10:00Z'),
"membership_status": "pending",
"join_method": "invite_code",
"notes": "Joined via invite code during orientation.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"joined_at": new Date('2026-03-05T09:12:00Z'),
"membership_status": "removed",
"join_method": "invite_code",
"notes": "Joined successfully and verified.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"joined_at": new Date('2026-03-06T09:15:00Z'),
"membership_status": "active",
"join_method": "invite_code",
"notes": "Transferred from another section.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"joined_at": new Date('2026-03-07T10:00:00Z'),
"membership_status": "pending",
"join_method": "invite_code",
"notes": "Pending confirmation by adviser.",
// type code here for "relation_one" field
},
];
const TeachingAssignmentsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assignment_role": "subject_teacher",
"assigned_at": new Date('2026-02-15T08:00:00Z'),
// type code here for "relation_one" field
"is_active": true,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assignment_role": "adviser",
"assigned_at": new Date('2026-02-15T08:05:00Z'),
// type code here for "relation_one" field
"is_active": true,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assignment_role": "adviser",
"assigned_at": new Date('2026-02-16T08:00:00Z'),
// type code here for "relation_one" field
"is_active": true,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assignment_role": "adviser",
"assigned_at": new Date('2026-02-16T08:10:00Z'),
// type code here for "relation_one" field
"is_active": true,
// type code here for "relation_one" field
},
];
const HomeworksData = [
{
"homework_title": "Integers and Number Lines Practice",
"homework_description": "Complete the worksheet and show your solutions clearly.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assigned_at": new Date('2026-04-01T08:00:00Z'),
"due_at": new Date('2026-04-05T23:59:00Z'),
"late_until_at": new Date('2026-04-07T23:59:00Z'),
"homework_status": "closed",
"max_score": 50,
"allow_late": true,
// type code here for "files" field
"requires_face_verification": true,
// type code here for "relation_one" field
},
{
"homework_title": "Reading Response: Short Story",
"homework_description": "Write a one page response focusing on theme and character development.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assigned_at": new Date('2026-04-02T08:00:00Z'),
"due_at": new Date('2026-04-06T23:59:00Z'),
"late_until_at": new Date('2026-04-08T23:59:00Z'),
"homework_status": "archived",
"max_score": 40,
"allow_late": true,
// type code here for "files" field
"requires_face_verification": false,
// type code here for "relation_one" field
},
{
"homework_title": "Science Lab Reflection",
"homework_description": "Summarize the experiment steps and include observations and conclusions.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assigned_at": new Date('2026-04-03T08:00:00Z'),
"due_at": new Date('2026-04-09T23:59:00Z'),
"late_until_at": new Date('2026-04-11T23:59:00Z'),
"homework_status": "published",
"max_score": 30,
"allow_late": true,
// type code here for "files" field
"requires_face_verification": false,
// type code here for "relation_one" field
},
{
"homework_title": "Algebra Basics Quiz Prep",
"homework_description": "Answer the practice questions and review mistakes.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"assigned_at": new Date('2026-04-04T08:00:00Z'),
"due_at": new Date('2026-04-10T23:59:00Z'),
"late_until_at": new Date('2026-04-12T23:59:00Z'),
"homework_status": "closed",
"max_score": 25,
"allow_late": true,
// type code here for "files" field
"requires_face_verification": true,
// type code here for "relation_one" field
},
];
const HomeworkRubricsData = [
{
// type code here for "relation_one" field
"criterion_title": "Accuracy",
"criterion_description": "Correct solutions and appropriate methods.",
"criterion_max_score": 25,
"sort_order": 1,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"criterion_title": "Work Shown",
"criterion_description": "Steps are shown and easy to follow.",
"criterion_max_score": 15,
"sort_order": 2,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"criterion_title": "Neatness",
"criterion_description": "Legible and well organized work.",
"criterion_max_score": 10,
"sort_order": 3,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"criterion_title": "Content Understanding",
"criterion_description": "Shows understanding of the story and themes.",
"criterion_max_score": 20,
"sort_order": 1,
// type code here for "relation_one" field
},
];
const HomeworkExtensionsData = [
{
// type code here for "relation_one" field
"extension_scope": "all_students",
// type code here for "relation_many" field
"extended_due_at": new Date('2026-04-08T23:59:00Z'),
"extended_late_until_at": new Date('2026-04-10T23:59:00Z'),
"reason": "Approved extension due to documented absence.",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"extension_scope": "all_students",
// type code here for "relation_many" field
"extended_due_at": new Date('2026-04-06T23:59:00Z'),
"extended_late_until_at": new Date('2026-04-08T23:59:00Z'),
"reason": "Class schedule adjustment.",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"extension_scope": "all_students",
// type code here for "relation_many" field
"extended_due_at": new Date('2026-04-11T23:59:00Z'),
"extended_late_until_at": new Date('2026-04-13T23:59:00Z'),
"reason": "Lab partner change and makeup session.",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"extension_scope": "all_students",
// type code here for "relation_many" field
"extended_due_at": new Date('2026-04-12T23:59:00Z'),
"extended_late_until_at": new Date('2026-04-14T23:59:00Z'),
"reason": "Approved extension for family emergency.",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
];
const HomeworkSubmissionsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-05T18:20:00Z'),
"submission_status": "missing",
// type code here for "files" field
"submission_text": "Completed all items and reviewed answers.",
// type code here for "images" field
"face_verified_for_submission": true,
"face_verified_at": new Date('2026-04-05T18:19:30Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-06T22:10:00Z'),
"submission_status": "draft",
// type code here for "files" field
"submission_text": "Submitted after deadline with full work shown.",
// type code here for "images" field
"face_verified_for_submission": true,
"face_verified_at": new Date('2026-04-06T22:09:30Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-06T19:05:00Z'),
"submission_status": "resubmitted",
// type code here for "files" field
"submission_text": "Response focuses on theme and character choices.",
// type code here for "images" field
"face_verified_for_submission": false,
"face_verified_at": new Date('2026-04-06T19:05:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-08T20:30:00Z'),
"submission_status": "submitted",
// type code here for "files" field
"submission_text": "Submitted within approved extension window.",
// type code here for "images" field
"face_verified_for_submission": false,
"face_verified_at": new Date('2026-04-08T20:30:00Z'),
// type code here for "relation_one" field
},
];
const SubmissionGradesData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"graded_at": new Date('2026-04-06T10:00:00Z'),
"total_score": 46,
"max_score_snapshot": 50,
"grade_status": "graded",
"teacher_feedback": "Strong accuracy and clear work shown. Minor sign errors.",
"returned_to_student": true,
"returned_at": new Date('2026-04-06T10:05:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"graded_at": new Date('2026-04-07T11:00:00Z'),
"total_score": 40,
"max_score_snapshot": 50,
"grade_status": "not_graded",
"teacher_feedback": "Good effort. Please double check number line direction on items 4 and 7.",
"returned_to_student": true,
"returned_at": new Date('2026-04-07T11:05:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"graded_at": new Date('2026-04-07T09:30:00Z'),
"total_score": 34,
"max_score_snapshot": 40,
"grade_status": "in_review",
"teacher_feedback": "Clear theme discussion. Add a stronger concluding paragraph next time.",
"returned_to_student": true,
"returned_at": new Date('2026-04-07T09:35:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"graded_at": new Date('2026-04-09T09:30:00Z'),
"total_score": 38,
"max_score_snapshot": 40,
"grade_status": "graded",
"teacher_feedback": "Well organized and thoughtful response.",
"returned_to_student": true,
"returned_at": new Date('2026-04-09T09:35:00Z'),
// type code here for "relation_one" field
},
];
const RubricScoresData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 23,
"comment": "Mostly correct with minor arithmetic slips.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 14,
"comment": "Steps are shown clearly.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 9,
"comment": "Neat and readable.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 17,
"comment": "Good understanding of theme and examples.",
// type code here for "relation_one" field
},
];
const GradebooksData = [
{
"gradebook_name": "G7A Mathematics Q4",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"term": "q2",
"start_at": new Date('2026-03-15T00:00:00Z'),
"end_at": new Date('2026-05-30T23:59:59Z'),
"is_published": false,
},
{
"gradebook_name": "G7A English Q4",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"term": "semester2",
"start_at": new Date('2026-03-15T00:00:00Z'),
"end_at": new Date('2026-05-30T23:59:59Z'),
"is_published": false,
},
{
"gradebook_name": "G8A Science Q4",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"term": "q4",
"start_at": new Date('2026-03-15T00:00:00Z'),
"end_at": new Date('2026-05-30T23:59:59Z'),
"is_published": false,
},
{
"gradebook_name": "G7B Mathematics Q4",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"term": "q4",
"start_at": new Date('2026-03-15T00:00:00Z'),
"end_at": new Date('2026-05-30T23:59:59Z'),
"is_published": false,
},
];
const GradebookColumnsData = [
{
// type code here for "relation_one" field
"column_name": "Homework 1",
"column_type": "homework",
"max_score": 50,
"weight": 1,
"sort_order": 1,
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"column_name": "Reading Response 1",
"column_type": "homework",
"max_score": 40,
"weight": 1,
"sort_order": 1,
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"column_name": "Lab Reflection 1",
"column_type": "custom",
"max_score": 30,
"weight": 1,
"sort_order": 1,
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"column_name": "Quiz 1",
"column_type": "custom",
"max_score": 25,
"weight": 1,
"sort_order": 2,
// type code here for "relation_one" field
// type code here for "relation_one" field
},
];
const GradebookEntriesData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 46,
"entry_status": "missing",
"recorded_at": new Date('2026-04-06T10:10:00Z'),
// type code here for "relation_one" field
"remarks": "Good progress.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 40,
"entry_status": "missing",
"recorded_at": new Date('2026-04-07T11:10:00Z'),
// type code here for "relation_one" field
"remarks": "Late but complete.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 34,
"entry_status": "normal",
"recorded_at": new Date('2026-04-07T09:40:00Z'),
// type code here for "relation_one" field
"remarks": "Improve conclusion.",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"score": 38,
"entry_status": "excused",
"recorded_at": new Date('2026-04-09T09:40:00Z'),
// type code here for "relation_one" field
"remarks": "Excellent organization.",
// type code here for "relation_one" field
},
];
const AdviserReportsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-10T12:00:00Z'),
"report_status": "draft",
"summary_notes": "Grade 7A math performance is stable with strong completion rates.",
// type code here for "files" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-10T13:00:00Z'),
"report_status": "draft",
"summary_notes": "English writing quality is improving; focus on conclusions and structure.",
// type code here for "files" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-10T14:00:00Z'),
"report_status": "draft",
"summary_notes": "Science lab reflections show good engagement; encourage deeper analysis.",
// type code here for "files" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"submitted_at": new Date('2026-04-10T15:00:00Z'),
"report_status": "rejected",
"summary_notes": "Draft report for Grade 7B math.",
// type code here for "files" field
// type code here for "relation_one" field
},
];
const AnnouncementsData = [
{
"announcement_title": "Welcome to Quarter 4",
"announcement_body": "Please check your class pages regularly for homework and updates.",
"audience_type": "role_based",
// type code here for "relation_one" field
// type code here for "relation_one" field
"target_role": "teacher",
// type code here for "relation_one" field
"posted_at": new Date('2026-03-15T08:00:00Z'),
"expires_at": new Date('2026-05-31T23:59:59Z'),
"pinned": true,
// type code here for "files" field
},
{
"announcement_title": "Faculty Meeting Schedule",
"announcement_body": "Faculty meeting will be held on Wednesday at 3 PM in the conference room.",
"audience_type": "school",
// type code here for "relation_one" field
// type code here for "relation_one" field
"target_role": "principal",
// type code here for "relation_one" field
"posted_at": new Date('2026-04-01T09:00:00Z'),
"expires_at": new Date('2026-04-30T23:59:59Z'),
"pinned": false,
// type code here for "files" field
},
{
"announcement_title": "Grade 7A Project Reminder",
"announcement_body": "Remember to submit your reading response by the due date shown in the homework card.",
"audience_type": "role_based",
// type code here for "relation_one" field
// type code here for "relation_one" field
"target_role": "student",
// type code here for "relation_one" field
"posted_at": new Date('2026-04-04T10:00:00Z'),
"expires_at": new Date('2026-04-08T23:59:59Z'),
"pinned": true,
// type code here for "files" field
},
{
"announcement_title": "System Maintenance Notice",
"announcement_body": "The portal will be available but may be slower during the maintenance window.",
"audience_type": "global",
// type code here for "relation_one" field
// type code here for "relation_one" field
"target_role": "teacher",
// type code here for "relation_one" field
"posted_at": new Date('2026-04-05T07:00:00Z'),
"expires_at": new Date('2026-04-06T23:00:00Z'),
"pinned": false,
// type code here for "files" field
},
];
const NotificationsData = [
{
// type code here for "relation_one" field
"notification_type": "security",
"title": "Homework due soon",
"message": "Integers and Number Lines Practice is due on Apr 5.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"is_read": true,
"read_at": new Date('2026-04-05T08:10:00Z'),
"sent_at": new Date('2026-04-05T08:00:00Z'),
"priority": "normal",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "submission_received",
"title": "Project reminder",
"message": "Grade 7A Project Reminder posted for your classroom.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"is_read": true,
"read_at": new Date('2026-04-11T00:00:00Z'),
"sent_at": new Date('2026-04-04T10:01:00Z'),
"priority": "low",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "homework_assigned",
"title": "Grade posted",
"message": "Your homework score is available for Integers and Number Lines Practice.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"is_read": true,
"read_at": new Date('2026-04-06T12:00:00Z'),
"sent_at": new Date('2026-04-06T10:06:00Z'),
"priority": "normal",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "homework_assigned",
"title": "New adviser report submitted",
"message": "A gradebook report has been submitted for review.",
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"is_read": false,
"read_at": new Date('2026-04-11T00:00:00Z'),
"sent_at": new Date('2026-04-10T14:01:00Z'),
"priority": "low",
// type code here for "relation_one" field
// type code here for "relation_one" field
},
];
const AccountApplicationsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"requested_role": "principal",
"application_status": "needs_more_info",
"application_notes": "Student application completed with required details.",
// type code here for "relation_one" field
"reviewed_at": new Date('2026-03-01T08:10:00Z'),
// type code here for "files" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"requested_role": "principal",
"application_status": "pending",
"application_notes": "Application verified by registrar.",
// type code here for "relation_one" field
"reviewed_at": new Date('2026-03-01T08:12:00Z'),
// type code here for "files" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"requested_role": "principal",
"application_status": "rejected",
"application_notes": "Approved after face verification.",
// type code here for "relation_one" field
"reviewed_at": new Date('2026-03-01T08:15:00Z'),
// type code here for "files" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"requested_role": "student",
"application_status": "pending",
"application_notes": "Teaching credentials verified by school office.",
// type code here for "relation_one" field
"reviewed_at": new Date('2026-02-09T12:00:00Z'),
// type code here for "files" field
},
];
const GuardiansData = [
{
"guardian_name": "Maria Santos",
"relationship": "Mother",
"phone_number": "+1-555-8001",
"email": "maria.santos@familymail.com",
"address": "18 Pine Street, Springfield",
// type code here for "relation_one" field
},
{
"guardian_name": "Ravi Patel",
"relationship": "Father",
"phone_number": "+1-555-8002",
"email": "ravi.patel@familymail.com",
"address": "22 Maple Avenue, Springfield",
// type code here for "relation_one" field
},
{
"guardian_name": "Hana Kim",
"relationship": "Mother",
"phone_number": "+1-555-8003",
"email": "hana.kim@familymail.com",
"address": "5 Cedar Lane, Springfield",
// type code here for "relation_one" field
},
{
"guardian_name": "Grace Turner",
"relationship": "Guardian",
"phone_number": "+1-555-8004",
"email": "grace.turner@familymail.com",
"address": "90 River Road, Brookfield",
// type code here for "relation_one" field
},
];
const SecurityEventsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"event_type": "data_export",
"event_at": new Date('2026-04-10T20:30:10Z'),
"ip_address": "203.0.113.10",
"user_agent": "Chrome on Windows",
"risk_level": "low",
"details": "Successful login from recognized device.",
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"event_type": "suspicious_activity",
"event_at": new Date('2026-04-10T20:12:05Z'),
"ip_address": "203.0.113.11",
"user_agent": "Chrome on Android",
"risk_level": "medium",
"details": "Failed login attempt due to incorrect password.",
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"event_type": "login_failed",
"event_at": new Date('2026-04-09T08:00:00Z'),
"ip_address": "203.0.113.50",
"user_agent": "Edge on Windows",
"risk_level": "high",
"details": "Attempted access to restricted monitoring page.",
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"event_type": "login_failed",
"event_at": new Date('2026-04-05T18:19:30Z'),
"ip_address": "203.0.113.10",
"user_agent": "Chrome on Windows",
"risk_level": "low",
"details": "Face verification completed for submission.",
},
];
const SupportSettingsData = [
{
"support_email": "support@homeworkportal.example",
"support_phone": "+1-555-9000",
"support_hours": "Mon-Fri 09:00-17:00",
"privacy_policy_url": "https://homeworkportal.example/privacy",
"terms_url": "https://homeworkportal.example/terms",
"app_version_notes": "Quarter 4 improvements include faster grading views and clearer due date banners.",
// type code here for "relation_one" field
},
{
"support_email": "help@homeworkportal.example",
"support_phone": "+1-555-9001",
"support_hours": "Mon-Fri 08:00-18:00",
"privacy_policy_url": "https://homeworkportal.example/privacy",
"terms_url": "https://homeworkportal.example/terms",
"app_version_notes": "Security events dashboard refinements and notification performance updates.",
// type code here for "relation_one" field
},
{
"support_email": "cs@homeworkportal.example",
"support_phone": "+1-555-9002",
"support_hours": "Mon-Sat 09:00-16:00",
"privacy_policy_url": "https://homeworkportal.example/privacy",
"terms_url": "https://homeworkportal.example/terms",
"app_version_notes": "Face verification stability updates and minor UI adjustments.",
// type code here for "relation_one" field
},
{
"support_email": "service@homeworkportal.example",
"support_phone": "+1-555-9003",
"support_hours": "Mon-Fri 09:00-17:00",
"privacy_policy_url": "https://homeworkportal.example/privacy",
"terms_url": "https://homeworkportal.example/terms",
"app_version_notes": "Improved classroom invite flow and account approval queue sorting.",
// type code here for "relation_one" field
},
];
const FeedbackItemsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"rating": 5,
"feedback_type": "other",
"feedback_title": "Clear homework list",
"feedback_message": "The due date cards make it easy to track what is next.",
// type code here for "files" field
"status": "triaged",
"submitted_at": new Date('2026-04-08T10:15:00Z'),
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"rating": 4,
"feedback_type": "performance",
"feedback_title": "Calendar reminders",
"feedback_message": "Please add a way to sync homework deadlines to a calendar.",
// type code here for "files" field
"status": "in_progress",
"submitted_at": new Date('2026-04-08T11:20:00Z'),
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"rating": 4,
"feedback_type": "performance",
"feedback_title": "Gradebook loads slowly",
"feedback_message": "The gradebook page is slightly slow with many columns.",
// type code here for "files" field
"status": "in_progress",
"submitted_at": new Date('2026-04-09T09:00:00Z'),
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"rating": 5,
"feedback_type": "performance",
"feedback_title": "Rubric templates",
"feedback_message": "Reusable rubric templates would save time for recurring assignments.",
// type code here for "files" field
"status": "resolved",
"submitted_at": new Date('2026-04-09T10:05:00Z'),
},
];
const EventsData = [
{
"event_name": "Spring Learning Challenge",
"event_description": "A school wide challenge encouraging consistent homework submission.",
"event_type": "promo",
"price": 0,
"start_at": new Date('2026-04-15T00:00:00Z'),
"end_at": new Date('2026-04-30T23:59:59Z'),
"visibility": "school_only",
// type code here for "relation_one" field
"is_active": true,
},
{
"event_name": "STEM Webinar Series",
"event_description": "Live online sessions with guest speakers on STEM careers.",
"event_type": "competition",
"price": 5,
"start_at": new Date('2026-05-05T16:00:00Z'),
"end_at": new Date('2026-05-05T17:30:00Z'),
"visibility": "school_only",
// type code here for "relation_one" field
"is_active": true,
},
{
"event_name": "App Boost Promo Pack",
"event_description": "Optional add on to highlight school achievements in announcements.",
"event_type": "school_event",
"price": 19.99,
"start_at": new Date('2026-04-20T00:00:00Z'),
"end_at": new Date('2026-06-01T23:59:59Z'),
"visibility": "school_only",
// type code here for "relation_one" field
"is_active": true,
},
{
"event_name": "Science Fair Registration",
"event_description": "Registration window for the annual science fair.",
"event_type": "school_event",
"price": 0,
"start_at": new Date('2026-04-18T00:00:00Z'),
"end_at": new Date('2026-04-25T23:59:59Z'),
"visibility": "school_only",
// type code here for "relation_one" field
"is_active": true,
},
];
const AiMonitoringRulesData = [
{
"rule_name": "Brute Force Login Detector",
"rule_type": "suspicious_ip",
"severity": "critical",
"enabled": true,
"rule_description": "Flag repeated failed logins from the same IP within a short window.",
"threshold_value": 10,
// type code here for "relation_one" field
},
{
"rule_name": "Anomalous Login Location",
"rule_type": "policy_violation",
"severity": "high",
"enabled": true,
"rule_description": "Detect logins from unusual IP ranges compared to user history.",
"threshold_value": 0.8,
// type code here for "relation_one" field
},
{
"rule_name": "Mass Download Watch",
"rule_type": "face_mismatch",
"severity": "low",
"enabled": true,
"rule_description": "Identify unusually high volume file downloads within a session.",
"threshold_value": 50,
// type code here for "relation_one" field
},
{
"rule_name": "Face Verification Mismatch Alert",
"rule_type": "policy_violation",
"severity": "critical",
"enabled": true,
"rule_description": "Raise alert when face verification fails repeatedly for submissions.",
"threshold_value": 3,
// type code here for "relation_one" field
},
];
// Similar logic for "relation_many"
async function associateUserWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const User0 = await Users.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (User0?.setSchool)
{
await
User0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const User1 = await Users.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (User1?.setSchool)
{
await
User1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const User2 = await Users.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (User2?.setSchool)
{
await
User2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const User3 = await Users.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (User3?.setSchool)
{
await
User3.
setSchool(relatedSchool3);
}
}
async function associateGradeLevelWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradeLevel0 = await GradeLevels.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradeLevel0?.setSchool)
{
await
GradeLevel0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradeLevel1 = await GradeLevels.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradeLevel1?.setSchool)
{
await
GradeLevel1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradeLevel2 = await GradeLevels.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradeLevel2?.setSchool)
{
await
GradeLevel2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradeLevel3 = await GradeLevels.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradeLevel3?.setSchool)
{
await
GradeLevel3.
setSchool(relatedSchool3);
}
}
async function associateSubjectWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Subject0 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Subject0?.setSchool)
{
await
Subject0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Subject1 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Subject1?.setSchool)
{
await
Subject1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Subject2 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Subject2?.setSchool)
{
await
Subject2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Subject3 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Subject3?.setSchool)
{
await
Subject3.
setSchool(relatedSchool3);
}
}
async function associateSubjectWithGrade_level() {
const relatedGrade_level0 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Subject0 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Subject0?.setGrade_level)
{
await
Subject0.
setGrade_level(relatedGrade_level0);
}
const relatedGrade_level1 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Subject1 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Subject1?.setGrade_level)
{
await
Subject1.
setGrade_level(relatedGrade_level1);
}
const relatedGrade_level2 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Subject2 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Subject2?.setGrade_level)
{
await
Subject2.
setGrade_level(relatedGrade_level2);
}
const relatedGrade_level3 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Subject3 = await Subjects.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Subject3?.setGrade_level)
{
await
Subject3.
setGrade_level(relatedGrade_level3);
}
}
async function associateClassroomWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Classroom0 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Classroom0?.setSchool)
{
await
Classroom0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Classroom1 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Classroom1?.setSchool)
{
await
Classroom1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Classroom2 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Classroom2?.setSchool)
{
await
Classroom2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Classroom3 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Classroom3?.setSchool)
{
await
Classroom3.
setSchool(relatedSchool3);
}
}
async function associateClassroomWithGrade_level() {
const relatedGrade_level0 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Classroom0 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Classroom0?.setGrade_level)
{
await
Classroom0.
setGrade_level(relatedGrade_level0);
}
const relatedGrade_level1 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Classroom1 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Classroom1?.setGrade_level)
{
await
Classroom1.
setGrade_level(relatedGrade_level1);
}
const relatedGrade_level2 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Classroom2 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Classroom2?.setGrade_level)
{
await
Classroom2.
setGrade_level(relatedGrade_level2);
}
const relatedGrade_level3 = await GradeLevels.findOne({
offset: Math.floor(Math.random() * (await GradeLevels.count())),
});
const Classroom3 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Classroom3?.setGrade_level)
{
await
Classroom3.
setGrade_level(relatedGrade_level3);
}
}
async function associateClassroomWithAdviser_teacher() {
const relatedAdviser_teacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Classroom0 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Classroom0?.setAdviser_teacher)
{
await
Classroom0.
setAdviser_teacher(relatedAdviser_teacher0);
}
const relatedAdviser_teacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Classroom1 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Classroom1?.setAdviser_teacher)
{
await
Classroom1.
setAdviser_teacher(relatedAdviser_teacher1);
}
const relatedAdviser_teacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Classroom2 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Classroom2?.setAdviser_teacher)
{
await
Classroom2.
setAdviser_teacher(relatedAdviser_teacher2);
}
const relatedAdviser_teacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Classroom3 = await Classrooms.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Classroom3?.setAdviser_teacher)
{
await
Classroom3.
setAdviser_teacher(relatedAdviser_teacher3);
}
}
async function associateClassroomMembershipWithClassroom() {
const relatedClassroom0 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const ClassroomMembership0 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ClassroomMembership0?.setClassroom)
{
await
ClassroomMembership0.
setClassroom(relatedClassroom0);
}
const relatedClassroom1 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const ClassroomMembership1 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ClassroomMembership1?.setClassroom)
{
await
ClassroomMembership1.
setClassroom(relatedClassroom1);
}
const relatedClassroom2 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const ClassroomMembership2 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ClassroomMembership2?.setClassroom)
{
await
ClassroomMembership2.
setClassroom(relatedClassroom2);
}
const relatedClassroom3 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const ClassroomMembership3 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ClassroomMembership3?.setClassroom)
{
await
ClassroomMembership3.
setClassroom(relatedClassroom3);
}
}
async function associateClassroomMembershipWithStudent() {
const relatedStudent0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const ClassroomMembership0 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ClassroomMembership0?.setStudent)
{
await
ClassroomMembership0.
setStudent(relatedStudent0);
}
const relatedStudent1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const ClassroomMembership1 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ClassroomMembership1?.setStudent)
{
await
ClassroomMembership1.
setStudent(relatedStudent1);
}
const relatedStudent2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const ClassroomMembership2 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ClassroomMembership2?.setStudent)
{
await
ClassroomMembership2.
setStudent(relatedStudent2);
}
const relatedStudent3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const ClassroomMembership3 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ClassroomMembership3?.setStudent)
{
await
ClassroomMembership3.
setStudent(relatedStudent3);
}
}
async function associateClassroomMembershipWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const ClassroomMembership0 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ClassroomMembership0?.setSchool)
{
await
ClassroomMembership0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const ClassroomMembership1 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ClassroomMembership1?.setSchool)
{
await
ClassroomMembership1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const ClassroomMembership2 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ClassroomMembership2?.setSchool)
{
await
ClassroomMembership2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const ClassroomMembership3 = await ClassroomMemberships.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ClassroomMembership3?.setSchool)
{
await
ClassroomMembership3.
setSchool(relatedSchool3);
}
}
async function associateTeachingAssignmentWithTeacher() {
const relatedTeacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment0 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TeachingAssignment0?.setTeacher)
{
await
TeachingAssignment0.
setTeacher(relatedTeacher0);
}
const relatedTeacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment1 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TeachingAssignment1?.setTeacher)
{
await
TeachingAssignment1.
setTeacher(relatedTeacher1);
}
const relatedTeacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment2 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TeachingAssignment2?.setTeacher)
{
await
TeachingAssignment2.
setTeacher(relatedTeacher2);
}
const relatedTeacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment3 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TeachingAssignment3?.setTeacher)
{
await
TeachingAssignment3.
setTeacher(relatedTeacher3);
}
}
async function associateTeachingAssignmentWithClassroom() {
const relatedClassroom0 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const TeachingAssignment0 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TeachingAssignment0?.setClassroom)
{
await
TeachingAssignment0.
setClassroom(relatedClassroom0);
}
const relatedClassroom1 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const TeachingAssignment1 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TeachingAssignment1?.setClassroom)
{
await
TeachingAssignment1.
setClassroom(relatedClassroom1);
}
const relatedClassroom2 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const TeachingAssignment2 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TeachingAssignment2?.setClassroom)
{
await
TeachingAssignment2.
setClassroom(relatedClassroom2);
}
const relatedClassroom3 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const TeachingAssignment3 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TeachingAssignment3?.setClassroom)
{
await
TeachingAssignment3.
setClassroom(relatedClassroom3);
}
}
async function associateTeachingAssignmentWithSubject() {
const relatedSubject0 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const TeachingAssignment0 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TeachingAssignment0?.setSubject)
{
await
TeachingAssignment0.
setSubject(relatedSubject0);
}
const relatedSubject1 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const TeachingAssignment1 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TeachingAssignment1?.setSubject)
{
await
TeachingAssignment1.
setSubject(relatedSubject1);
}
const relatedSubject2 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const TeachingAssignment2 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TeachingAssignment2?.setSubject)
{
await
TeachingAssignment2.
setSubject(relatedSubject2);
}
const relatedSubject3 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const TeachingAssignment3 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TeachingAssignment3?.setSubject)
{
await
TeachingAssignment3.
setSubject(relatedSubject3);
}
}
async function associateTeachingAssignmentWithAssigned_by() {
const relatedAssigned_by0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment0 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TeachingAssignment0?.setAssigned_by)
{
await
TeachingAssignment0.
setAssigned_by(relatedAssigned_by0);
}
const relatedAssigned_by1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment1 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TeachingAssignment1?.setAssigned_by)
{
await
TeachingAssignment1.
setAssigned_by(relatedAssigned_by1);
}
const relatedAssigned_by2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment2 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TeachingAssignment2?.setAssigned_by)
{
await
TeachingAssignment2.
setAssigned_by(relatedAssigned_by2);
}
const relatedAssigned_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TeachingAssignment3 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TeachingAssignment3?.setAssigned_by)
{
await
TeachingAssignment3.
setAssigned_by(relatedAssigned_by3);
}
}
async function associateTeachingAssignmentWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const TeachingAssignment0 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TeachingAssignment0?.setSchool)
{
await
TeachingAssignment0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const TeachingAssignment1 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TeachingAssignment1?.setSchool)
{
await
TeachingAssignment1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const TeachingAssignment2 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TeachingAssignment2?.setSchool)
{
await
TeachingAssignment2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const TeachingAssignment3 = await TeachingAssignments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TeachingAssignment3?.setSchool)
{
await
TeachingAssignment3.
setSchool(relatedSchool3);
}
}
async function associateHomeworkWithClassroom() {
const relatedClassroom0 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Homework0 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Homework0?.setClassroom)
{
await
Homework0.
setClassroom(relatedClassroom0);
}
const relatedClassroom1 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Homework1 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Homework1?.setClassroom)
{
await
Homework1.
setClassroom(relatedClassroom1);
}
const relatedClassroom2 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Homework2 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Homework2?.setClassroom)
{
await
Homework2.
setClassroom(relatedClassroom2);
}
const relatedClassroom3 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Homework3 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Homework3?.setClassroom)
{
await
Homework3.
setClassroom(relatedClassroom3);
}
}
async function associateHomeworkWithSubject() {
const relatedSubject0 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Homework0 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Homework0?.setSubject)
{
await
Homework0.
setSubject(relatedSubject0);
}
const relatedSubject1 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Homework1 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Homework1?.setSubject)
{
await
Homework1.
setSubject(relatedSubject1);
}
const relatedSubject2 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Homework2 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Homework2?.setSubject)
{
await
Homework2.
setSubject(relatedSubject2);
}
const relatedSubject3 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Homework3 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Homework3?.setSubject)
{
await
Homework3.
setSubject(relatedSubject3);
}
}
async function associateHomeworkWithTeacher() {
const relatedTeacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Homework0 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Homework0?.setTeacher)
{
await
Homework0.
setTeacher(relatedTeacher0);
}
const relatedTeacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Homework1 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Homework1?.setTeacher)
{
await
Homework1.
setTeacher(relatedTeacher1);
}
const relatedTeacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Homework2 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Homework2?.setTeacher)
{
await
Homework2.
setTeacher(relatedTeacher2);
}
const relatedTeacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Homework3 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Homework3?.setTeacher)
{
await
Homework3.
setTeacher(relatedTeacher3);
}
}
async function associateHomeworkWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Homework0 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Homework0?.setSchool)
{
await
Homework0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Homework1 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Homework1?.setSchool)
{
await
Homework1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Homework2 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Homework2?.setSchool)
{
await
Homework2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Homework3 = await Homeworks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Homework3?.setSchool)
{
await
Homework3.
setSchool(relatedSchool3);
}
}
async function associateHomeworkRubricWithHomework() {
const relatedHomework0 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkRubric0 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkRubric0?.setHomework)
{
await
HomeworkRubric0.
setHomework(relatedHomework0);
}
const relatedHomework1 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkRubric1 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkRubric1?.setHomework)
{
await
HomeworkRubric1.
setHomework(relatedHomework1);
}
const relatedHomework2 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkRubric2 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkRubric2?.setHomework)
{
await
HomeworkRubric2.
setHomework(relatedHomework2);
}
const relatedHomework3 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkRubric3 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkRubric3?.setHomework)
{
await
HomeworkRubric3.
setHomework(relatedHomework3);
}
}
async function associateHomeworkRubricWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkRubric0 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkRubric0?.setSchool)
{
await
HomeworkRubric0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkRubric1 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkRubric1?.setSchool)
{
await
HomeworkRubric1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkRubric2 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkRubric2?.setSchool)
{
await
HomeworkRubric2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkRubric3 = await HomeworkRubrics.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkRubric3?.setSchool)
{
await
HomeworkRubric3.
setSchool(relatedSchool3);
}
}
async function associateHomeworkExtensionWithHomework() {
const relatedHomework0 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkExtension0 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkExtension0?.setHomework)
{
await
HomeworkExtension0.
setHomework(relatedHomework0);
}
const relatedHomework1 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkExtension1 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkExtension1?.setHomework)
{
await
HomeworkExtension1.
setHomework(relatedHomework1);
}
const relatedHomework2 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkExtension2 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkExtension2?.setHomework)
{
await
HomeworkExtension2.
setHomework(relatedHomework2);
}
const relatedHomework3 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkExtension3 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkExtension3?.setHomework)
{
await
HomeworkExtension3.
setHomework(relatedHomework3);
}
}
// Similar logic for "relation_many"
async function associateHomeworkExtensionWithCreated_by_user() {
const relatedCreated_by_user0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkExtension0 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkExtension0?.setCreated_by_user)
{
await
HomeworkExtension0.
setCreated_by_user(relatedCreated_by_user0);
}
const relatedCreated_by_user1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkExtension1 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkExtension1?.setCreated_by_user)
{
await
HomeworkExtension1.
setCreated_by_user(relatedCreated_by_user1);
}
const relatedCreated_by_user2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkExtension2 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkExtension2?.setCreated_by_user)
{
await
HomeworkExtension2.
setCreated_by_user(relatedCreated_by_user2);
}
const relatedCreated_by_user3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkExtension3 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkExtension3?.setCreated_by_user)
{
await
HomeworkExtension3.
setCreated_by_user(relatedCreated_by_user3);
}
}
async function associateHomeworkExtensionWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkExtension0 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkExtension0?.setSchool)
{
await
HomeworkExtension0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkExtension1 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkExtension1?.setSchool)
{
await
HomeworkExtension1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkExtension2 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkExtension2?.setSchool)
{
await
HomeworkExtension2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkExtension3 = await HomeworkExtensions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkExtension3?.setSchool)
{
await
HomeworkExtension3.
setSchool(relatedSchool3);
}
}
async function associateHomeworkSubmissionWithHomework() {
const relatedHomework0 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkSubmission0 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkSubmission0?.setHomework)
{
await
HomeworkSubmission0.
setHomework(relatedHomework0);
}
const relatedHomework1 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkSubmission1 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkSubmission1?.setHomework)
{
await
HomeworkSubmission1.
setHomework(relatedHomework1);
}
const relatedHomework2 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkSubmission2 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkSubmission2?.setHomework)
{
await
HomeworkSubmission2.
setHomework(relatedHomework2);
}
const relatedHomework3 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const HomeworkSubmission3 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkSubmission3?.setHomework)
{
await
HomeworkSubmission3.
setHomework(relatedHomework3);
}
}
async function associateHomeworkSubmissionWithStudent() {
const relatedStudent0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkSubmission0 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkSubmission0?.setStudent)
{
await
HomeworkSubmission0.
setStudent(relatedStudent0);
}
const relatedStudent1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkSubmission1 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkSubmission1?.setStudent)
{
await
HomeworkSubmission1.
setStudent(relatedStudent1);
}
const relatedStudent2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkSubmission2 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkSubmission2?.setStudent)
{
await
HomeworkSubmission2.
setStudent(relatedStudent2);
}
const relatedStudent3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const HomeworkSubmission3 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkSubmission3?.setStudent)
{
await
HomeworkSubmission3.
setStudent(relatedStudent3);
}
}
async function associateHomeworkSubmissionWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkSubmission0 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (HomeworkSubmission0?.setSchool)
{
await
HomeworkSubmission0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkSubmission1 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (HomeworkSubmission1?.setSchool)
{
await
HomeworkSubmission1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkSubmission2 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (HomeworkSubmission2?.setSchool)
{
await
HomeworkSubmission2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const HomeworkSubmission3 = await HomeworkSubmissions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (HomeworkSubmission3?.setSchool)
{
await
HomeworkSubmission3.
setSchool(relatedSchool3);
}
}
async function associateSubmissionGradeWithSubmission() {
const relatedSubmission0 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const SubmissionGrade0 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (SubmissionGrade0?.setSubmission)
{
await
SubmissionGrade0.
setSubmission(relatedSubmission0);
}
const relatedSubmission1 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const SubmissionGrade1 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (SubmissionGrade1?.setSubmission)
{
await
SubmissionGrade1.
setSubmission(relatedSubmission1);
}
const relatedSubmission2 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const SubmissionGrade2 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (SubmissionGrade2?.setSubmission)
{
await
SubmissionGrade2.
setSubmission(relatedSubmission2);
}
const relatedSubmission3 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const SubmissionGrade3 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (SubmissionGrade3?.setSubmission)
{
await
SubmissionGrade3.
setSubmission(relatedSubmission3);
}
}
async function associateSubmissionGradeWithGraded_by_teacher() {
const relatedGraded_by_teacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SubmissionGrade0 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (SubmissionGrade0?.setGraded_by_teacher)
{
await
SubmissionGrade0.
setGraded_by_teacher(relatedGraded_by_teacher0);
}
const relatedGraded_by_teacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SubmissionGrade1 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (SubmissionGrade1?.setGraded_by_teacher)
{
await
SubmissionGrade1.
setGraded_by_teacher(relatedGraded_by_teacher1);
}
const relatedGraded_by_teacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SubmissionGrade2 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (SubmissionGrade2?.setGraded_by_teacher)
{
await
SubmissionGrade2.
setGraded_by_teacher(relatedGraded_by_teacher2);
}
const relatedGraded_by_teacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SubmissionGrade3 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (SubmissionGrade3?.setGraded_by_teacher)
{
await
SubmissionGrade3.
setGraded_by_teacher(relatedGraded_by_teacher3);
}
}
async function associateSubmissionGradeWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SubmissionGrade0 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (SubmissionGrade0?.setSchool)
{
await
SubmissionGrade0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SubmissionGrade1 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (SubmissionGrade1?.setSchool)
{
await
SubmissionGrade1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SubmissionGrade2 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (SubmissionGrade2?.setSchool)
{
await
SubmissionGrade2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SubmissionGrade3 = await SubmissionGrades.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (SubmissionGrade3?.setSchool)
{
await
SubmissionGrade3.
setSchool(relatedSchool3);
}
}
async function associateRubricScoreWithSubmission_grade() {
const relatedSubmission_grade0 = await SubmissionGrades.findOne({
offset: Math.floor(Math.random() * (await SubmissionGrades.count())),
});
const RubricScore0 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (RubricScore0?.setSubmission_grade)
{
await
RubricScore0.
setSubmission_grade(relatedSubmission_grade0);
}
const relatedSubmission_grade1 = await SubmissionGrades.findOne({
offset: Math.floor(Math.random() * (await SubmissionGrades.count())),
});
const RubricScore1 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (RubricScore1?.setSubmission_grade)
{
await
RubricScore1.
setSubmission_grade(relatedSubmission_grade1);
}
const relatedSubmission_grade2 = await SubmissionGrades.findOne({
offset: Math.floor(Math.random() * (await SubmissionGrades.count())),
});
const RubricScore2 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (RubricScore2?.setSubmission_grade)
{
await
RubricScore2.
setSubmission_grade(relatedSubmission_grade2);
}
const relatedSubmission_grade3 = await SubmissionGrades.findOne({
offset: Math.floor(Math.random() * (await SubmissionGrades.count())),
});
const RubricScore3 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (RubricScore3?.setSubmission_grade)
{
await
RubricScore3.
setSubmission_grade(relatedSubmission_grade3);
}
}
async function associateRubricScoreWithRubric_item() {
const relatedRubric_item0 = await HomeworkRubrics.findOne({
offset: Math.floor(Math.random() * (await HomeworkRubrics.count())),
});
const RubricScore0 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (RubricScore0?.setRubric_item)
{
await
RubricScore0.
setRubric_item(relatedRubric_item0);
}
const relatedRubric_item1 = await HomeworkRubrics.findOne({
offset: Math.floor(Math.random() * (await HomeworkRubrics.count())),
});
const RubricScore1 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (RubricScore1?.setRubric_item)
{
await
RubricScore1.
setRubric_item(relatedRubric_item1);
}
const relatedRubric_item2 = await HomeworkRubrics.findOne({
offset: Math.floor(Math.random() * (await HomeworkRubrics.count())),
});
const RubricScore2 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (RubricScore2?.setRubric_item)
{
await
RubricScore2.
setRubric_item(relatedRubric_item2);
}
const relatedRubric_item3 = await HomeworkRubrics.findOne({
offset: Math.floor(Math.random() * (await HomeworkRubrics.count())),
});
const RubricScore3 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (RubricScore3?.setRubric_item)
{
await
RubricScore3.
setRubric_item(relatedRubric_item3);
}
}
async function associateRubricScoreWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const RubricScore0 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (RubricScore0?.setSchool)
{
await
RubricScore0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const RubricScore1 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (RubricScore1?.setSchool)
{
await
RubricScore1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const RubricScore2 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (RubricScore2?.setSchool)
{
await
RubricScore2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const RubricScore3 = await RubricScores.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (RubricScore3?.setSchool)
{
await
RubricScore3.
setSchool(relatedSchool3);
}
}
async function associateGradebookWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Gradebook0 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Gradebook0?.setSchool)
{
await
Gradebook0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Gradebook1 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Gradebook1?.setSchool)
{
await
Gradebook1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Gradebook2 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Gradebook2?.setSchool)
{
await
Gradebook2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Gradebook3 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Gradebook3?.setSchool)
{
await
Gradebook3.
setSchool(relatedSchool3);
}
}
async function associateGradebookWithClassroom() {
const relatedClassroom0 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Gradebook0 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Gradebook0?.setClassroom)
{
await
Gradebook0.
setClassroom(relatedClassroom0);
}
const relatedClassroom1 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Gradebook1 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Gradebook1?.setClassroom)
{
await
Gradebook1.
setClassroom(relatedClassroom1);
}
const relatedClassroom2 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Gradebook2 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Gradebook2?.setClassroom)
{
await
Gradebook2.
setClassroom(relatedClassroom2);
}
const relatedClassroom3 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Gradebook3 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Gradebook3?.setClassroom)
{
await
Gradebook3.
setClassroom(relatedClassroom3);
}
}
async function associateGradebookWithSubject() {
const relatedSubject0 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Gradebook0 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Gradebook0?.setSubject)
{
await
Gradebook0.
setSubject(relatedSubject0);
}
const relatedSubject1 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Gradebook1 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Gradebook1?.setSubject)
{
await
Gradebook1.
setSubject(relatedSubject1);
}
const relatedSubject2 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Gradebook2 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Gradebook2?.setSubject)
{
await
Gradebook2.
setSubject(relatedSubject2);
}
const relatedSubject3 = await Subjects.findOne({
offset: Math.floor(Math.random() * (await Subjects.count())),
});
const Gradebook3 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Gradebook3?.setSubject)
{
await
Gradebook3.
setSubject(relatedSubject3);
}
}
async function associateGradebookWithOwner_teacher() {
const relatedOwner_teacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Gradebook0 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Gradebook0?.setOwner_teacher)
{
await
Gradebook0.
setOwner_teacher(relatedOwner_teacher0);
}
const relatedOwner_teacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Gradebook1 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Gradebook1?.setOwner_teacher)
{
await
Gradebook1.
setOwner_teacher(relatedOwner_teacher1);
}
const relatedOwner_teacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Gradebook2 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Gradebook2?.setOwner_teacher)
{
await
Gradebook2.
setOwner_teacher(relatedOwner_teacher2);
}
const relatedOwner_teacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Gradebook3 = await Gradebooks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Gradebook3?.setOwner_teacher)
{
await
Gradebook3.
setOwner_teacher(relatedOwner_teacher3);
}
}
async function associateGradebookColumnWithGradebook() {
const relatedGradebook0 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const GradebookColumn0 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookColumn0?.setGradebook)
{
await
GradebookColumn0.
setGradebook(relatedGradebook0);
}
const relatedGradebook1 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const GradebookColumn1 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookColumn1?.setGradebook)
{
await
GradebookColumn1.
setGradebook(relatedGradebook1);
}
const relatedGradebook2 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const GradebookColumn2 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookColumn2?.setGradebook)
{
await
GradebookColumn2.
setGradebook(relatedGradebook2);
}
const relatedGradebook3 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const GradebookColumn3 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookColumn3?.setGradebook)
{
await
GradebookColumn3.
setGradebook(relatedGradebook3);
}
}
async function associateGradebookColumnWithHomework() {
const relatedHomework0 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const GradebookColumn0 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookColumn0?.setHomework)
{
await
GradebookColumn0.
setHomework(relatedHomework0);
}
const relatedHomework1 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const GradebookColumn1 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookColumn1?.setHomework)
{
await
GradebookColumn1.
setHomework(relatedHomework1);
}
const relatedHomework2 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const GradebookColumn2 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookColumn2?.setHomework)
{
await
GradebookColumn2.
setHomework(relatedHomework2);
}
const relatedHomework3 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const GradebookColumn3 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookColumn3?.setHomework)
{
await
GradebookColumn3.
setHomework(relatedHomework3);
}
}
async function associateGradebookColumnWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookColumn0 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookColumn0?.setSchool)
{
await
GradebookColumn0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookColumn1 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookColumn1?.setSchool)
{
await
GradebookColumn1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookColumn2 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookColumn2?.setSchool)
{
await
GradebookColumn2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookColumn3 = await GradebookColumns.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookColumn3?.setSchool)
{
await
GradebookColumn3.
setSchool(relatedSchool3);
}
}
async function associateGradebookEntryWithGradebook_column() {
const relatedGradebook_column0 = await GradebookColumns.findOne({
offset: Math.floor(Math.random() * (await GradebookColumns.count())),
});
const GradebookEntry0 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookEntry0?.setGradebook_column)
{
await
GradebookEntry0.
setGradebook_column(relatedGradebook_column0);
}
const relatedGradebook_column1 = await GradebookColumns.findOne({
offset: Math.floor(Math.random() * (await GradebookColumns.count())),
});
const GradebookEntry1 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookEntry1?.setGradebook_column)
{
await
GradebookEntry1.
setGradebook_column(relatedGradebook_column1);
}
const relatedGradebook_column2 = await GradebookColumns.findOne({
offset: Math.floor(Math.random() * (await GradebookColumns.count())),
});
const GradebookEntry2 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookEntry2?.setGradebook_column)
{
await
GradebookEntry2.
setGradebook_column(relatedGradebook_column2);
}
const relatedGradebook_column3 = await GradebookColumns.findOne({
offset: Math.floor(Math.random() * (await GradebookColumns.count())),
});
const GradebookEntry3 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookEntry3?.setGradebook_column)
{
await
GradebookEntry3.
setGradebook_column(relatedGradebook_column3);
}
}
async function associateGradebookEntryWithStudent() {
const relatedStudent0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry0 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookEntry0?.setStudent)
{
await
GradebookEntry0.
setStudent(relatedStudent0);
}
const relatedStudent1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry1 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookEntry1?.setStudent)
{
await
GradebookEntry1.
setStudent(relatedStudent1);
}
const relatedStudent2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry2 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookEntry2?.setStudent)
{
await
GradebookEntry2.
setStudent(relatedStudent2);
}
const relatedStudent3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry3 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookEntry3?.setStudent)
{
await
GradebookEntry3.
setStudent(relatedStudent3);
}
}
async function associateGradebookEntryWithRecorded_by() {
const relatedRecorded_by0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry0 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookEntry0?.setRecorded_by)
{
await
GradebookEntry0.
setRecorded_by(relatedRecorded_by0);
}
const relatedRecorded_by1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry1 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookEntry1?.setRecorded_by)
{
await
GradebookEntry1.
setRecorded_by(relatedRecorded_by1);
}
const relatedRecorded_by2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry2 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookEntry2?.setRecorded_by)
{
await
GradebookEntry2.
setRecorded_by(relatedRecorded_by2);
}
const relatedRecorded_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const GradebookEntry3 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookEntry3?.setRecorded_by)
{
await
GradebookEntry3.
setRecorded_by(relatedRecorded_by3);
}
}
async function associateGradebookEntryWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookEntry0 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (GradebookEntry0?.setSchool)
{
await
GradebookEntry0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookEntry1 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (GradebookEntry1?.setSchool)
{
await
GradebookEntry1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookEntry2 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (GradebookEntry2?.setSchool)
{
await
GradebookEntry2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const GradebookEntry3 = await GradebookEntries.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (GradebookEntry3?.setSchool)
{
await
GradebookEntry3.
setSchool(relatedSchool3);
}
}
async function associateAdviserReportWithGradebook() {
const relatedGradebook0 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const AdviserReport0 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AdviserReport0?.setGradebook)
{
await
AdviserReport0.
setGradebook(relatedGradebook0);
}
const relatedGradebook1 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const AdviserReport1 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AdviserReport1?.setGradebook)
{
await
AdviserReport1.
setGradebook(relatedGradebook1);
}
const relatedGradebook2 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const AdviserReport2 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AdviserReport2?.setGradebook)
{
await
AdviserReport2.
setGradebook(relatedGradebook2);
}
const relatedGradebook3 = await Gradebooks.findOne({
offset: Math.floor(Math.random() * (await Gradebooks.count())),
});
const AdviserReport3 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AdviserReport3?.setGradebook)
{
await
AdviserReport3.
setGradebook(relatedGradebook3);
}
}
async function associateAdviserReportWithAdviser_teacher() {
const relatedAdviser_teacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport0 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AdviserReport0?.setAdviser_teacher)
{
await
AdviserReport0.
setAdviser_teacher(relatedAdviser_teacher0);
}
const relatedAdviser_teacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport1 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AdviserReport1?.setAdviser_teacher)
{
await
AdviserReport1.
setAdviser_teacher(relatedAdviser_teacher1);
}
const relatedAdviser_teacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport2 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AdviserReport2?.setAdviser_teacher)
{
await
AdviserReport2.
setAdviser_teacher(relatedAdviser_teacher2);
}
const relatedAdviser_teacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport3 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AdviserReport3?.setAdviser_teacher)
{
await
AdviserReport3.
setAdviser_teacher(relatedAdviser_teacher3);
}
}
async function associateAdviserReportWithSubmitted_by_teacher() {
const relatedSubmitted_by_teacher0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport0 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AdviserReport0?.setSubmitted_by_teacher)
{
await
AdviserReport0.
setSubmitted_by_teacher(relatedSubmitted_by_teacher0);
}
const relatedSubmitted_by_teacher1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport1 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AdviserReport1?.setSubmitted_by_teacher)
{
await
AdviserReport1.
setSubmitted_by_teacher(relatedSubmitted_by_teacher1);
}
const relatedSubmitted_by_teacher2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport2 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AdviserReport2?.setSubmitted_by_teacher)
{
await
AdviserReport2.
setSubmitted_by_teacher(relatedSubmitted_by_teacher2);
}
const relatedSubmitted_by_teacher3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AdviserReport3 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AdviserReport3?.setSubmitted_by_teacher)
{
await
AdviserReport3.
setSubmitted_by_teacher(relatedSubmitted_by_teacher3);
}
}
async function associateAdviserReportWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AdviserReport0 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AdviserReport0?.setSchool)
{
await
AdviserReport0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AdviserReport1 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AdviserReport1?.setSchool)
{
await
AdviserReport1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AdviserReport2 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AdviserReport2?.setSchool)
{
await
AdviserReport2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AdviserReport3 = await AdviserReports.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AdviserReport3?.setSchool)
{
await
AdviserReport3.
setSchool(relatedSchool3);
}
}
async function associateAnnouncementWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Announcement0 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Announcement0?.setSchool)
{
await
Announcement0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Announcement1 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Announcement1?.setSchool)
{
await
Announcement1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Announcement2 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Announcement2?.setSchool)
{
await
Announcement2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Announcement3 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Announcement3?.setSchool)
{
await
Announcement3.
setSchool(relatedSchool3);
}
}
async function associateAnnouncementWithClassroom() {
const relatedClassroom0 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Announcement0 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Announcement0?.setClassroom)
{
await
Announcement0.
setClassroom(relatedClassroom0);
}
const relatedClassroom1 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Announcement1 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Announcement1?.setClassroom)
{
await
Announcement1.
setClassroom(relatedClassroom1);
}
const relatedClassroom2 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Announcement2 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Announcement2?.setClassroom)
{
await
Announcement2.
setClassroom(relatedClassroom2);
}
const relatedClassroom3 = await Classrooms.findOne({
offset: Math.floor(Math.random() * (await Classrooms.count())),
});
const Announcement3 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Announcement3?.setClassroom)
{
await
Announcement3.
setClassroom(relatedClassroom3);
}
}
async function associateAnnouncementWithPosted_by() {
const relatedPosted_by0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Announcement0 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Announcement0?.setPosted_by)
{
await
Announcement0.
setPosted_by(relatedPosted_by0);
}
const relatedPosted_by1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Announcement1 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Announcement1?.setPosted_by)
{
await
Announcement1.
setPosted_by(relatedPosted_by1);
}
const relatedPosted_by2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Announcement2 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Announcement2?.setPosted_by)
{
await
Announcement2.
setPosted_by(relatedPosted_by2);
}
const relatedPosted_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Announcement3 = await Announcements.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Announcement3?.setPosted_by)
{
await
Announcement3.
setPosted_by(relatedPosted_by3);
}
}
async function associateNotificationWithRecipient() {
const relatedRecipient0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setRecipient)
{
await
Notification0.
setRecipient(relatedRecipient0);
}
const relatedRecipient1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setRecipient)
{
await
Notification1.
setRecipient(relatedRecipient1);
}
const relatedRecipient2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setRecipient)
{
await
Notification2.
setRecipient(relatedRecipient2);
}
const relatedRecipient3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setRecipient)
{
await
Notification3.
setRecipient(relatedRecipient3);
}
}
async function associateNotificationWithAnnouncement() {
const relatedAnnouncement0 = await Announcements.findOne({
offset: Math.floor(Math.random() * (await Announcements.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setAnnouncement)
{
await
Notification0.
setAnnouncement(relatedAnnouncement0);
}
const relatedAnnouncement1 = await Announcements.findOne({
offset: Math.floor(Math.random() * (await Announcements.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setAnnouncement)
{
await
Notification1.
setAnnouncement(relatedAnnouncement1);
}
const relatedAnnouncement2 = await Announcements.findOne({
offset: Math.floor(Math.random() * (await Announcements.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setAnnouncement)
{
await
Notification2.
setAnnouncement(relatedAnnouncement2);
}
const relatedAnnouncement3 = await Announcements.findOne({
offset: Math.floor(Math.random() * (await Announcements.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setAnnouncement)
{
await
Notification3.
setAnnouncement(relatedAnnouncement3);
}
}
async function associateNotificationWithHomework() {
const relatedHomework0 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setHomework)
{
await
Notification0.
setHomework(relatedHomework0);
}
const relatedHomework1 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setHomework)
{
await
Notification1.
setHomework(relatedHomework1);
}
const relatedHomework2 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setHomework)
{
await
Notification2.
setHomework(relatedHomework2);
}
const relatedHomework3 = await Homeworks.findOne({
offset: Math.floor(Math.random() * (await Homeworks.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setHomework)
{
await
Notification3.
setHomework(relatedHomework3);
}
}
async function associateNotificationWithSubmission() {
const relatedSubmission0 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setSubmission)
{
await
Notification0.
setSubmission(relatedSubmission0);
}
const relatedSubmission1 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setSubmission)
{
await
Notification1.
setSubmission(relatedSubmission1);
}
const relatedSubmission2 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setSubmission)
{
await
Notification2.
setSubmission(relatedSubmission2);
}
const relatedSubmission3 = await HomeworkSubmissions.findOne({
offset: Math.floor(Math.random() * (await HomeworkSubmissions.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setSubmission)
{
await
Notification3.
setSubmission(relatedSubmission3);
}
}
async function associateNotificationWithSent_by() {
const relatedSent_by0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setSent_by)
{
await
Notification0.
setSent_by(relatedSent_by0);
}
const relatedSent_by1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setSent_by)
{
await
Notification1.
setSent_by(relatedSent_by1);
}
const relatedSent_by2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setSent_by)
{
await
Notification2.
setSent_by(relatedSent_by2);
}
const relatedSent_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setSent_by)
{
await
Notification3.
setSent_by(relatedSent_by3);
}
}
async function associateNotificationWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setSchool)
{
await
Notification0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setSchool)
{
await
Notification1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setSchool)
{
await
Notification2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setSchool)
{
await
Notification3.
setSchool(relatedSchool3);
}
}
async function associateAccountApplicationWithApplicant() {
const relatedApplicant0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication0 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AccountApplication0?.setApplicant)
{
await
AccountApplication0.
setApplicant(relatedApplicant0);
}
const relatedApplicant1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication1 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AccountApplication1?.setApplicant)
{
await
AccountApplication1.
setApplicant(relatedApplicant1);
}
const relatedApplicant2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication2 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AccountApplication2?.setApplicant)
{
await
AccountApplication2.
setApplicant(relatedApplicant2);
}
const relatedApplicant3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication3 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AccountApplication3?.setApplicant)
{
await
AccountApplication3.
setApplicant(relatedApplicant3);
}
}
async function associateAccountApplicationWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AccountApplication0 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AccountApplication0?.setSchool)
{
await
AccountApplication0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AccountApplication1 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AccountApplication1?.setSchool)
{
await
AccountApplication1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AccountApplication2 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AccountApplication2?.setSchool)
{
await
AccountApplication2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AccountApplication3 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AccountApplication3?.setSchool)
{
await
AccountApplication3.
setSchool(relatedSchool3);
}
}
async function associateAccountApplicationWithReviewed_by() {
const relatedReviewed_by0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication0 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AccountApplication0?.setReviewed_by)
{
await
AccountApplication0.
setReviewed_by(relatedReviewed_by0);
}
const relatedReviewed_by1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication1 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AccountApplication1?.setReviewed_by)
{
await
AccountApplication1.
setReviewed_by(relatedReviewed_by1);
}
const relatedReviewed_by2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication2 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AccountApplication2?.setReviewed_by)
{
await
AccountApplication2.
setReviewed_by(relatedReviewed_by2);
}
const relatedReviewed_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountApplication3 = await AccountApplications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AccountApplication3?.setReviewed_by)
{
await
AccountApplication3.
setReviewed_by(relatedReviewed_by3);
}
}
async function associateGuardianWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Guardian0 = await Guardians.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Guardian0?.setSchool)
{
await
Guardian0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Guardian1 = await Guardians.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Guardian1?.setSchool)
{
await
Guardian1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Guardian2 = await Guardians.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Guardian2?.setSchool)
{
await
Guardian2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Guardian3 = await Guardians.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Guardian3?.setSchool)
{
await
Guardian3.
setSchool(relatedSchool3);
}
}
async function associateSecurityEventWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SecurityEvent0 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (SecurityEvent0?.setSchool)
{
await
SecurityEvent0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SecurityEvent1 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (SecurityEvent1?.setSchool)
{
await
SecurityEvent1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SecurityEvent2 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (SecurityEvent2?.setSchool)
{
await
SecurityEvent2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SecurityEvent3 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (SecurityEvent3?.setSchool)
{
await
SecurityEvent3.
setSchool(relatedSchool3);
}
}
async function associateSecurityEventWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SecurityEvent0 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (SecurityEvent0?.setUser)
{
await
SecurityEvent0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SecurityEvent1 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (SecurityEvent1?.setUser)
{
await
SecurityEvent1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SecurityEvent2 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (SecurityEvent2?.setUser)
{
await
SecurityEvent2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const SecurityEvent3 = await SecurityEvents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (SecurityEvent3?.setUser)
{
await
SecurityEvent3.
setUser(relatedUser3);
}
}
async function associateSupportSettingWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SupportSetting0 = await SupportSettings.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (SupportSetting0?.setSchool)
{
await
SupportSetting0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SupportSetting1 = await SupportSettings.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (SupportSetting1?.setSchool)
{
await
SupportSetting1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SupportSetting2 = await SupportSettings.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (SupportSetting2?.setSchool)
{
await
SupportSetting2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const SupportSetting3 = await SupportSettings.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (SupportSetting3?.setSchool)
{
await
SupportSetting3.
setSchool(relatedSchool3);
}
}
async function associateFeedbackItemWithSubmitted_by() {
const relatedSubmitted_by0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const FeedbackItem0 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (FeedbackItem0?.setSubmitted_by)
{
await
FeedbackItem0.
setSubmitted_by(relatedSubmitted_by0);
}
const relatedSubmitted_by1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const FeedbackItem1 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (FeedbackItem1?.setSubmitted_by)
{
await
FeedbackItem1.
setSubmitted_by(relatedSubmitted_by1);
}
const relatedSubmitted_by2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const FeedbackItem2 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (FeedbackItem2?.setSubmitted_by)
{
await
FeedbackItem2.
setSubmitted_by(relatedSubmitted_by2);
}
const relatedSubmitted_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const FeedbackItem3 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (FeedbackItem3?.setSubmitted_by)
{
await
FeedbackItem3.
setSubmitted_by(relatedSubmitted_by3);
}
}
async function associateFeedbackItemWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const FeedbackItem0 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (FeedbackItem0?.setSchool)
{
await
FeedbackItem0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const FeedbackItem1 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (FeedbackItem1?.setSchool)
{
await
FeedbackItem1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const FeedbackItem2 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (FeedbackItem2?.setSchool)
{
await
FeedbackItem2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const FeedbackItem3 = await FeedbackItems.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (FeedbackItem3?.setSchool)
{
await
FeedbackItem3.
setSchool(relatedSchool3);
}
}
async function associateEventWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Event0 = await Events.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Event0?.setSchool)
{
await
Event0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Event1 = await Events.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Event1?.setSchool)
{
await
Event1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Event2 = await Events.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Event2?.setSchool)
{
await
Event2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const Event3 = await Events.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Event3?.setSchool)
{
await
Event3.
setSchool(relatedSchool3);
}
}
async function associateAiMonitoringRuleWithSchool() {
const relatedSchool0 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AiMonitoringRule0 = await AiMonitoringRules.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AiMonitoringRule0?.setSchool)
{
await
AiMonitoringRule0.
setSchool(relatedSchool0);
}
const relatedSchool1 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AiMonitoringRule1 = await AiMonitoringRules.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AiMonitoringRule1?.setSchool)
{
await
AiMonitoringRule1.
setSchool(relatedSchool1);
}
const relatedSchool2 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AiMonitoringRule2 = await AiMonitoringRules.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AiMonitoringRule2?.setSchool)
{
await
AiMonitoringRule2.
setSchool(relatedSchool2);
}
const relatedSchool3 = await Schools.findOne({
offset: Math.floor(Math.random() * (await Schools.count())),
});
const AiMonitoringRule3 = await AiMonitoringRules.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AiMonitoringRule3?.setSchool)
{
await
AiMonitoringRule3.
setSchool(relatedSchool3);
}
}
module.exports = {
up: async (queryInterface, Sequelize) => {
await Schools.bulkCreate(SchoolsData);
await GradeLevels.bulkCreate(GradeLevelsData);
await Subjects.bulkCreate(SubjectsData);
await Classrooms.bulkCreate(ClassroomsData);
await ClassroomMemberships.bulkCreate(ClassroomMembershipsData);
await TeachingAssignments.bulkCreate(TeachingAssignmentsData);
await Homeworks.bulkCreate(HomeworksData);
await HomeworkRubrics.bulkCreate(HomeworkRubricsData);
await HomeworkExtensions.bulkCreate(HomeworkExtensionsData);
await HomeworkSubmissions.bulkCreate(HomeworkSubmissionsData);
await SubmissionGrades.bulkCreate(SubmissionGradesData);
await RubricScores.bulkCreate(RubricScoresData);
await Gradebooks.bulkCreate(GradebooksData);
await GradebookColumns.bulkCreate(GradebookColumnsData);
await GradebookEntries.bulkCreate(GradebookEntriesData);
await AdviserReports.bulkCreate(AdviserReportsData);
await Announcements.bulkCreate(AnnouncementsData);
await Notifications.bulkCreate(NotificationsData);
await AccountApplications.bulkCreate(AccountApplicationsData);
await Guardians.bulkCreate(GuardiansData);
await SecurityEvents.bulkCreate(SecurityEventsData);
await SupportSettings.bulkCreate(SupportSettingsData);
await FeedbackItems.bulkCreate(FeedbackItemsData);
await Events.bulkCreate(EventsData);
await AiMonitoringRules.bulkCreate(AiMonitoringRulesData);
await Promise.all([
// Similar logic for "relation_many"
await associateUserWithSchool(),
await associateGradeLevelWithSchool(),
await associateSubjectWithSchool(),
await associateSubjectWithGrade_level(),
await associateClassroomWithSchool(),
await associateClassroomWithGrade_level(),
await associateClassroomWithAdviser_teacher(),
await associateClassroomMembershipWithClassroom(),
await associateClassroomMembershipWithStudent(),
await associateClassroomMembershipWithSchool(),
await associateTeachingAssignmentWithTeacher(),
await associateTeachingAssignmentWithClassroom(),
await associateTeachingAssignmentWithSubject(),
await associateTeachingAssignmentWithAssigned_by(),
await associateTeachingAssignmentWithSchool(),
await associateHomeworkWithClassroom(),
await associateHomeworkWithSubject(),
await associateHomeworkWithTeacher(),
await associateHomeworkWithSchool(),
await associateHomeworkRubricWithHomework(),
await associateHomeworkRubricWithSchool(),
await associateHomeworkExtensionWithHomework(),
// Similar logic for "relation_many"
await associateHomeworkExtensionWithCreated_by_user(),
await associateHomeworkExtensionWithSchool(),
await associateHomeworkSubmissionWithHomework(),
await associateHomeworkSubmissionWithStudent(),
await associateHomeworkSubmissionWithSchool(),
await associateSubmissionGradeWithSubmission(),
await associateSubmissionGradeWithGraded_by_teacher(),
await associateSubmissionGradeWithSchool(),
await associateRubricScoreWithSubmission_grade(),
await associateRubricScoreWithRubric_item(),
await associateRubricScoreWithSchool(),
await associateGradebookWithSchool(),
await associateGradebookWithClassroom(),
await associateGradebookWithSubject(),
await associateGradebookWithOwner_teacher(),
await associateGradebookColumnWithGradebook(),
await associateGradebookColumnWithHomework(),
await associateGradebookColumnWithSchool(),
await associateGradebookEntryWithGradebook_column(),
await associateGradebookEntryWithStudent(),
await associateGradebookEntryWithRecorded_by(),
await associateGradebookEntryWithSchool(),
await associateAdviserReportWithGradebook(),
await associateAdviserReportWithAdviser_teacher(),
await associateAdviserReportWithSubmitted_by_teacher(),
await associateAdviserReportWithSchool(),
await associateAnnouncementWithSchool(),
await associateAnnouncementWithClassroom(),
await associateAnnouncementWithPosted_by(),
await associateNotificationWithRecipient(),
await associateNotificationWithAnnouncement(),
await associateNotificationWithHomework(),
await associateNotificationWithSubmission(),
await associateNotificationWithSent_by(),
await associateNotificationWithSchool(),
await associateAccountApplicationWithApplicant(),
await associateAccountApplicationWithSchool(),
await associateAccountApplicationWithReviewed_by(),
await associateGuardianWithSchool(),
await associateSecurityEventWithSchool(),
await associateSecurityEventWithUser(),
await associateSupportSettingWithSchool(),
await associateFeedbackItemWithSubmitted_by(),
await associateFeedbackItemWithSchool(),
await associateEventWithSchool(),
await associateAiMonitoringRuleWithSchool(),
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('schools', null, {});
await queryInterface.bulkDelete('grade_levels', null, {});
await queryInterface.bulkDelete('subjects', null, {});
await queryInterface.bulkDelete('classrooms', null, {});
await queryInterface.bulkDelete('classroom_memberships', null, {});
await queryInterface.bulkDelete('teaching_assignments', null, {});
await queryInterface.bulkDelete('homeworks', null, {});
await queryInterface.bulkDelete('homework_rubrics', null, {});
await queryInterface.bulkDelete('homework_extensions', null, {});
await queryInterface.bulkDelete('homework_submissions', null, {});
await queryInterface.bulkDelete('submission_grades', null, {});
await queryInterface.bulkDelete('rubric_scores', null, {});
await queryInterface.bulkDelete('gradebooks', null, {});
await queryInterface.bulkDelete('gradebook_columns', null, {});
await queryInterface.bulkDelete('gradebook_entries', null, {});
await queryInterface.bulkDelete('adviser_reports', null, {});
await queryInterface.bulkDelete('announcements', null, {});
await queryInterface.bulkDelete('notifications', null, {});
await queryInterface.bulkDelete('account_applications', null, {});
await queryInterface.bulkDelete('guardians', null, {});
await queryInterface.bulkDelete('security_events', null, {});
await queryInterface.bulkDelete('support_settings', null, {});
await queryInterface.bulkDelete('feedback_items', null, {});
await queryInterface.bulkDelete('events', null, {});
await queryInterface.bulkDelete('ai_monitoring_rules', null, {});
},
};