3839 lines
86 KiB
JavaScript
3839 lines
86 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Organizations = db.organizations;
|
|
|
|
const Departments = db.departments;
|
|
|
|
const Leads = db.leads;
|
|
|
|
const LeadEvaluations = db.lead_evaluations;
|
|
|
|
const LeadChecklists = db.lead_checklists;
|
|
|
|
const Tasks = db.tasks;
|
|
|
|
const Approvals = db.approvals;
|
|
|
|
const Meetings = db.meetings;
|
|
|
|
const MonitoringReports = db.monitoring_reports;
|
|
|
|
const Documents = db.documents;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const OrganizationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "NorthStar Insurance Group",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Harbor Mutual",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Atlas Specialty",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const DepartmentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Commercial",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Frontline commercial team managing client relationships and program intake",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_email": "commercial@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Pricing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Pricing and actuarial analysis for program validation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_email": "pricing@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Underwriting",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Underwriting assessment and final validation of risk appetite",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_email": "underwriting@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LeadsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Fleet Logistics Program",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"program_code": "FL-2026-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_name": "Global Logistics Ltd",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Comprehensive fleet operational cover for multinational logistics operations.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_volume": 1200000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"threshold_amount": 250000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_fast_track": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "PricingReview",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"primary_contact": "Olga Petrov",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"launch_date": new Date('2026-04-15T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Retail Warranty Portfolio",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"program_code": "RW-2026-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_name": "Cornerstone Retailers",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Warranty program across 400 store locations including extended warranties.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_volume": 450000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"threshold_amount": 150000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_fast_track": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "Draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"primary_contact": "Daniel Kim",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"launch_date": new Date('2026-06-01T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Energy Sector Liability",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"program_code": "EN-2026-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_name": "Delta Energy Partners",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Liability program for onshore energy contractors with bespoke limits.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_volume": 2200000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"threshold_amount": 500000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_fast_track": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "UnderwritingReview",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"primary_contact": "Hanna Johansen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"launch_date": new Date('2026-05-10T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LeadEvaluationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"part": "Part1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Initial pricing assessment completed with baseline assumptions.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Requires actuarial stress testing on loss frequency for long haul routes.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 78,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluation_date": new Date('2026-02-10T14:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"part": "Part1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Underwriting risk appetite check completed; vintage exposures flagged.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Fast track validation recommended due to volume above threshold.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 82,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluation_date": new Date('2026-02-12T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"part": "Part1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Pricing model calibrated for retail claims experience.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Include seasonal uplift in Q4 for retail returns.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"score": 70,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluation_date": new Date('2026-03-05T09:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LeadChecklistsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item": "Collect GTC draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"detail": "Obtain general terms and conditions draft from legal for review.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-02-20T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item": "Validate pricing inputs",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"detail": "Confirm exposure data and historical claims used in pricing model.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-03-10T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item": "Operational readiness review",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"detail": "IT to confirm SAP templates and connectivity for premium flows.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-03-25T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TasksData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Request actuarial run",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "Done",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "High",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-02-14T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Send exposure file and requested assumptions to actuarial team.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Legal review of contract annex",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "Open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "Medium",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-02-25T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Draft annex for third party vendor obligations.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Prepare pricing memo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "Blocked",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "Critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_date": new Date('2026-03-01T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Consolidate key pricing assumptions and sensitivity analysis.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ApprovalsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_title": "Underwriting Approval - Fleet Logistics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 300000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_threshold_exceeded": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "NeedsInfo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Approved with condition to increase excess on specific risk categories.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"decision_date": new Date('2026-02-12T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_title": "Pricing Approval - Retail Warranty",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 140000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_threshold_exceeded": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "NeedsInfo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Awaiting additional sales forecast to finalise premium split.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"decision_date": new Date('2026-03-07T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_title": "CPO Validation - Energy Liability",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 750000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_threshold_exceeded": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "NeedsInfo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "CPO requests further evidence on subcontractor exposures.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"decision_date": new Date('2026-03-21T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MeetingsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Kick Off - Fleet Logistics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_time": new Date('2026-02-18T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_time": new Date('2026-02-18T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Conference Room A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Agenda: roles, timelines, initial tasks assignment.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Pricing Deep Dive - Retail Warranty",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_time": new Date('2026-03-02T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_time": new Date('2026-03-02T15:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Online Meeting",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Review of assumptions and loss development factors.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Underwriting Validation - Energy Liability",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_time": new Date('2026-03-22T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_time": new Date('2026-03-22T12:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location": "Boardroom",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Confirm conditions and escalations for high exposure ports.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MonitoringReportsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"report_title": "Monthly Sales & Adherence - March",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"period_start": new Date('2026-03-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"period_end": new Date('2026-03-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sales_volume": 210000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"adherence_score": 92.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"remarks": "Strong uptake in western regions, minor data template issues.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"report_title": "Quarterly Review Q1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"period_start": new Date('2026-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"period_end": new Date('2026-03-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sales_volume": 125000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"adherence_score": 88.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"remarks": "Seasonal uptick noted, check premium split accuracy.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"report_title": "Operational KPIs April",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"period_start": new Date('2026-04-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"period_end": new Date('2026-04-30T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sales_volume": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"adherence_score": 95.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"remarks": "Pre-launch checks mostly complete, awaiting final documents.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const DocumentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Fleet_GTC_v1.pdf",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upload_date": new Date('2026-02-11T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"doc_type": "Contract",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "RetailPricingModel.xlsx",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upload_date": new Date('2026-03-01T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"doc_type": "Template",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Energy_Contract_Annex.docx",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upload_date": new Date('2026-03-18T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"doc_type": "Other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
async function associateUserWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User0 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (User0?.setOrganization)
|
|
{
|
|
await
|
|
User0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User1 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (User1?.setOrganization)
|
|
{
|
|
await
|
|
User1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User2 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (User2?.setOrganization)
|
|
{
|
|
await
|
|
User2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDepartmentWithHead() {
|
|
|
|
const relatedHead0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Department0 = await Departments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Department0?.setHead)
|
|
{
|
|
await
|
|
Department0.
|
|
setHead(relatedHead0);
|
|
}
|
|
|
|
const relatedHead1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Department1 = await Departments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Department1?.setHead)
|
|
{
|
|
await
|
|
Department1.
|
|
setHead(relatedHead1);
|
|
}
|
|
|
|
const relatedHead2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Department2 = await Departments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Department2?.setHead)
|
|
{
|
|
await
|
|
Department2.
|
|
setHead(relatedHead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDepartmentWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Department0 = await Departments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Department0?.setOrganization)
|
|
{
|
|
await
|
|
Department0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Department1 = await Departments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Department1?.setOrganization)
|
|
{
|
|
await
|
|
Department1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Department2 = await Departments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Department2?.setOrganization)
|
|
{
|
|
await
|
|
Department2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadWithSubmitted_by() {
|
|
|
|
const relatedSubmitted_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Lead0 = await Leads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lead0?.setSubmitted_by)
|
|
{
|
|
await
|
|
Lead0.
|
|
setSubmitted_by(relatedSubmitted_by0);
|
|
}
|
|
|
|
const relatedSubmitted_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Lead1 = await Leads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lead1?.setSubmitted_by)
|
|
{
|
|
await
|
|
Lead1.
|
|
setSubmitted_by(relatedSubmitted_by1);
|
|
}
|
|
|
|
const relatedSubmitted_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Lead2 = await Leads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lead2?.setSubmitted_by)
|
|
{
|
|
await
|
|
Lead2.
|
|
setSubmitted_by(relatedSubmitted_by2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lead0 = await Leads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lead0?.setOrganization)
|
|
{
|
|
await
|
|
Lead0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lead1 = await Leads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lead1?.setOrganization)
|
|
{
|
|
await
|
|
Lead1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lead2 = await Leads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lead2?.setOrganization)
|
|
{
|
|
await
|
|
Lead2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadEvaluationWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const LeadEvaluation0 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LeadEvaluation0?.setLead)
|
|
{
|
|
await
|
|
LeadEvaluation0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const LeadEvaluation1 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LeadEvaluation1?.setLead)
|
|
{
|
|
await
|
|
LeadEvaluation1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const LeadEvaluation2 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LeadEvaluation2?.setLead)
|
|
{
|
|
await
|
|
LeadEvaluation2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadEvaluationWithEvaluator() {
|
|
|
|
const relatedEvaluator0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const LeadEvaluation0 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LeadEvaluation0?.setEvaluator)
|
|
{
|
|
await
|
|
LeadEvaluation0.
|
|
setEvaluator(relatedEvaluator0);
|
|
}
|
|
|
|
const relatedEvaluator1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const LeadEvaluation1 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LeadEvaluation1?.setEvaluator)
|
|
{
|
|
await
|
|
LeadEvaluation1.
|
|
setEvaluator(relatedEvaluator1);
|
|
}
|
|
|
|
const relatedEvaluator2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const LeadEvaluation2 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LeadEvaluation2?.setEvaluator)
|
|
{
|
|
await
|
|
LeadEvaluation2.
|
|
setEvaluator(relatedEvaluator2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadEvaluationWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const LeadEvaluation0 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LeadEvaluation0?.setOrganization)
|
|
{
|
|
await
|
|
LeadEvaluation0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const LeadEvaluation1 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LeadEvaluation1?.setOrganization)
|
|
{
|
|
await
|
|
LeadEvaluation1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const LeadEvaluation2 = await LeadEvaluations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LeadEvaluation2?.setOrganization)
|
|
{
|
|
await
|
|
LeadEvaluation2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadChecklistWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const LeadChecklist0 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LeadChecklist0?.setLead)
|
|
{
|
|
await
|
|
LeadChecklist0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const LeadChecklist1 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LeadChecklist1?.setLead)
|
|
{
|
|
await
|
|
LeadChecklist1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const LeadChecklist2 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LeadChecklist2?.setLead)
|
|
{
|
|
await
|
|
LeadChecklist2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadChecklistWithCompleted_by() {
|
|
|
|
const relatedCompleted_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const LeadChecklist0 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LeadChecklist0?.setCompleted_by)
|
|
{
|
|
await
|
|
LeadChecklist0.
|
|
setCompleted_by(relatedCompleted_by0);
|
|
}
|
|
|
|
const relatedCompleted_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const LeadChecklist1 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LeadChecklist1?.setCompleted_by)
|
|
{
|
|
await
|
|
LeadChecklist1.
|
|
setCompleted_by(relatedCompleted_by1);
|
|
}
|
|
|
|
const relatedCompleted_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const LeadChecklist2 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LeadChecklist2?.setCompleted_by)
|
|
{
|
|
await
|
|
LeadChecklist2.
|
|
setCompleted_by(relatedCompleted_by2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLeadChecklistWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const LeadChecklist0 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (LeadChecklist0?.setOrganization)
|
|
{
|
|
await
|
|
LeadChecklist0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const LeadChecklist1 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (LeadChecklist1?.setOrganization)
|
|
{
|
|
await
|
|
LeadChecklist1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const LeadChecklist2 = await LeadChecklists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (LeadChecklist2?.setOrganization)
|
|
{
|
|
await
|
|
LeadChecklist2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setLead)
|
|
{
|
|
await
|
|
Task0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setLead)
|
|
{
|
|
await
|
|
Task1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setLead)
|
|
{
|
|
await
|
|
Task2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithAssigned_to() {
|
|
|
|
const relatedAssigned_to0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setAssigned_to)
|
|
{
|
|
await
|
|
Task0.
|
|
setAssigned_to(relatedAssigned_to0);
|
|
}
|
|
|
|
const relatedAssigned_to1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setAssigned_to)
|
|
{
|
|
await
|
|
Task1.
|
|
setAssigned_to(relatedAssigned_to1);
|
|
}
|
|
|
|
const relatedAssigned_to2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setAssigned_to)
|
|
{
|
|
await
|
|
Task2.
|
|
setAssigned_to(relatedAssigned_to2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithDepartment() {
|
|
|
|
const relatedDepartment0 = await Departments.findOne({
|
|
offset: Math.floor(Math.random() * (await Departments.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setDepartment)
|
|
{
|
|
await
|
|
Task0.
|
|
setDepartment(relatedDepartment0);
|
|
}
|
|
|
|
const relatedDepartment1 = await Departments.findOne({
|
|
offset: Math.floor(Math.random() * (await Departments.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setDepartment)
|
|
{
|
|
await
|
|
Task1.
|
|
setDepartment(relatedDepartment1);
|
|
}
|
|
|
|
const relatedDepartment2 = await Departments.findOne({
|
|
offset: Math.floor(Math.random() * (await Departments.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setDepartment)
|
|
{
|
|
await
|
|
Task2.
|
|
setDepartment(relatedDepartment2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setOrganization)
|
|
{
|
|
await
|
|
Task0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setOrganization)
|
|
{
|
|
await
|
|
Task1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setOrganization)
|
|
{
|
|
await
|
|
Task2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateApprovalWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Approval0 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Approval0?.setLead)
|
|
{
|
|
await
|
|
Approval0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Approval1 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Approval1?.setLead)
|
|
{
|
|
await
|
|
Approval1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Approval2 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Approval2?.setLead)
|
|
{
|
|
await
|
|
Approval2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateApprovalWithApprover() {
|
|
|
|
const relatedApprover0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Approval0 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Approval0?.setApprover)
|
|
{
|
|
await
|
|
Approval0.
|
|
setApprover(relatedApprover0);
|
|
}
|
|
|
|
const relatedApprover1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Approval1 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Approval1?.setApprover)
|
|
{
|
|
await
|
|
Approval1.
|
|
setApprover(relatedApprover1);
|
|
}
|
|
|
|
const relatedApprover2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Approval2 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Approval2?.setApprover)
|
|
{
|
|
await
|
|
Approval2.
|
|
setApprover(relatedApprover2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateApprovalWithDepartment() {
|
|
|
|
const relatedDepartment0 = await Departments.findOne({
|
|
offset: Math.floor(Math.random() * (await Departments.count())),
|
|
});
|
|
const Approval0 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Approval0?.setDepartment)
|
|
{
|
|
await
|
|
Approval0.
|
|
setDepartment(relatedDepartment0);
|
|
}
|
|
|
|
const relatedDepartment1 = await Departments.findOne({
|
|
offset: Math.floor(Math.random() * (await Departments.count())),
|
|
});
|
|
const Approval1 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Approval1?.setDepartment)
|
|
{
|
|
await
|
|
Approval1.
|
|
setDepartment(relatedDepartment1);
|
|
}
|
|
|
|
const relatedDepartment2 = await Departments.findOne({
|
|
offset: Math.floor(Math.random() * (await Departments.count())),
|
|
});
|
|
const Approval2 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Approval2?.setDepartment)
|
|
{
|
|
await
|
|
Approval2.
|
|
setDepartment(relatedDepartment2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateApprovalWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Approval0 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Approval0?.setOrganization)
|
|
{
|
|
await
|
|
Approval0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Approval1 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Approval1?.setOrganization)
|
|
{
|
|
await
|
|
Approval1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Approval2 = await Approvals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Approval2?.setOrganization)
|
|
{
|
|
await
|
|
Approval2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMeetingWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Meeting0 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Meeting0?.setLead)
|
|
{
|
|
await
|
|
Meeting0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Meeting1 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Meeting1?.setLead)
|
|
{
|
|
await
|
|
Meeting1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Meeting2 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Meeting2?.setLead)
|
|
{
|
|
await
|
|
Meeting2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMeetingWithOrganizer() {
|
|
|
|
const relatedOrganizer0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Meeting0 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Meeting0?.setOrganizer)
|
|
{
|
|
await
|
|
Meeting0.
|
|
setOrganizer(relatedOrganizer0);
|
|
}
|
|
|
|
const relatedOrganizer1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Meeting1 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Meeting1?.setOrganizer)
|
|
{
|
|
await
|
|
Meeting1.
|
|
setOrganizer(relatedOrganizer1);
|
|
}
|
|
|
|
const relatedOrganizer2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Meeting2 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Meeting2?.setOrganizer)
|
|
{
|
|
await
|
|
Meeting2.
|
|
setOrganizer(relatedOrganizer2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMeetingWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Meeting0 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Meeting0?.setOrganization)
|
|
{
|
|
await
|
|
Meeting0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Meeting1 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Meeting1?.setOrganization)
|
|
{
|
|
await
|
|
Meeting1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Meeting2 = await Meetings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Meeting2?.setOrganization)
|
|
{
|
|
await
|
|
Meeting2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMonitoringReportWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const MonitoringReport0 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MonitoringReport0?.setLead)
|
|
{
|
|
await
|
|
MonitoringReport0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const MonitoringReport1 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MonitoringReport1?.setLead)
|
|
{
|
|
await
|
|
MonitoringReport1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const MonitoringReport2 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MonitoringReport2?.setLead)
|
|
{
|
|
await
|
|
MonitoringReport2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMonitoringReportWithCreated_by() {
|
|
|
|
const relatedCreated_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MonitoringReport0 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MonitoringReport0?.setCreated_by)
|
|
{
|
|
await
|
|
MonitoringReport0.
|
|
setCreated_by(relatedCreated_by0);
|
|
}
|
|
|
|
const relatedCreated_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MonitoringReport1 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MonitoringReport1?.setCreated_by)
|
|
{
|
|
await
|
|
MonitoringReport1.
|
|
setCreated_by(relatedCreated_by1);
|
|
}
|
|
|
|
const relatedCreated_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MonitoringReport2 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MonitoringReport2?.setCreated_by)
|
|
{
|
|
await
|
|
MonitoringReport2.
|
|
setCreated_by(relatedCreated_by2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMonitoringReportWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MonitoringReport0 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MonitoringReport0?.setOrganization)
|
|
{
|
|
await
|
|
MonitoringReport0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MonitoringReport1 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MonitoringReport1?.setOrganization)
|
|
{
|
|
await
|
|
MonitoringReport1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MonitoringReport2 = await MonitoringReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MonitoringReport2?.setOrganization)
|
|
{
|
|
await
|
|
MonitoringReport2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDocumentWithLead() {
|
|
|
|
const relatedLead0 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Document0 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Document0?.setLead)
|
|
{
|
|
await
|
|
Document0.
|
|
setLead(relatedLead0);
|
|
}
|
|
|
|
const relatedLead1 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Document1 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Document1?.setLead)
|
|
{
|
|
await
|
|
Document1.
|
|
setLead(relatedLead1);
|
|
}
|
|
|
|
const relatedLead2 = await Leads.findOne({
|
|
offset: Math.floor(Math.random() * (await Leads.count())),
|
|
});
|
|
const Document2 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Document2?.setLead)
|
|
{
|
|
await
|
|
Document2.
|
|
setLead(relatedLead2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDocumentWithUploaded_by() {
|
|
|
|
const relatedUploaded_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document0 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Document0?.setUploaded_by)
|
|
{
|
|
await
|
|
Document0.
|
|
setUploaded_by(relatedUploaded_by0);
|
|
}
|
|
|
|
const relatedUploaded_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document1 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Document1?.setUploaded_by)
|
|
{
|
|
await
|
|
Document1.
|
|
setUploaded_by(relatedUploaded_by1);
|
|
}
|
|
|
|
const relatedUploaded_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document2 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Document2?.setUploaded_by)
|
|
{
|
|
await
|
|
Document2.
|
|
setUploaded_by(relatedUploaded_by2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDocumentWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document0 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Document0?.setOrganization)
|
|
{
|
|
await
|
|
Document0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document1 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Document1?.setOrganization)
|
|
{
|
|
await
|
|
Document1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document2 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Document2?.setOrganization)
|
|
{
|
|
await
|
|
Document2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Organizations.bulkCreate(OrganizationsData);
|
|
|
|
|
|
|
|
|
|
await Departments.bulkCreate(DepartmentsData);
|
|
|
|
|
|
|
|
|
|
await Leads.bulkCreate(LeadsData);
|
|
|
|
|
|
|
|
|
|
await LeadEvaluations.bulkCreate(LeadEvaluationsData);
|
|
|
|
|
|
|
|
|
|
await LeadChecklists.bulkCreate(LeadChecklistsData);
|
|
|
|
|
|
|
|
|
|
await Tasks.bulkCreate(TasksData);
|
|
|
|
|
|
|
|
|
|
await Approvals.bulkCreate(ApprovalsData);
|
|
|
|
|
|
|
|
|
|
await Meetings.bulkCreate(MeetingsData);
|
|
|
|
|
|
|
|
|
|
await MonitoringReports.bulkCreate(MonitoringReportsData);
|
|
|
|
|
|
|
|
|
|
await Documents.bulkCreate(DocumentsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
await associateUserWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDepartmentWithHead(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDepartmentWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadWithSubmitted_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadEvaluationWithLead(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadEvaluationWithEvaluator(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadEvaluationWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadChecklistWithLead(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadChecklistWithCompleted_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLeadChecklistWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithLead(),
|
|
|
|
|
|
|
|
|
|
await associateTaskWithAssigned_to(),
|
|
|
|
|
|
|
|
|
|
await associateTaskWithDepartment(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateApprovalWithLead(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateApprovalWithApprover(),
|
|
|
|
|
|
|
|
|
|
await associateApprovalWithDepartment(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateApprovalWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMeetingWithLead(),
|
|
|
|
|
|
|
|
|
|
await associateMeetingWithOrganizer(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMeetingWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMonitoringReportWithLead(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMonitoringReportWithCreated_by(),
|
|
|
|
|
|
|
|
|
|
await associateMonitoringReportWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDocumentWithLead(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDocumentWithUploaded_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDocumentWithOrganization(),
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('organizations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('departments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('leads', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('lead_evaluations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('lead_checklists', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('tasks', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('approvals', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('meetings', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('monitoring_reports', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('documents', null, {});
|
|
|
|
|
|
},
|
|
}; |