





















const db = require('../models');
const Users = db.users;






const Organizations = db.organizations;

const Tenants = db.tenants;

const RolePermissions = db.role_permissions;

const Pipelines = db.pipelines;

const DealStages = db.deal_stages;

const Companies = db.companies;

const Contacts = db.contacts;

const Leads = db.leads;

const Deals = db.deals;

const Activities = db.activities;

const Tasks = db.tasks;

const Reminders = db.reminders;

const EmailTemplates = db.email_templates;

const EmailNotifications = db.email_notifications;

const Imports = db.imports;

const Exports = db.exports;

const ApiClients = db.api_clients;

const ApiTokens = db.api_tokens;

const Webhooks = db.webhooks;

const WebhookDeliveries = db.webhook_deliveries;

const Integrations = db.integrations;

const CalendarAccounts = db.calendar_accounts;

const CalendarEvents = db.calendar_events;

const DashboardWidgets = db.dashboard_widgets;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Northstar Ventures",
            
        
    
    },
    
    {
    
        
        
            
                "name": "BluePeak Consulting",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Sunrise Retail Group",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Helio Manufacturing",
            
        
    
    },
    
];



const TenantsData = [
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "slug": "Alan Turing",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "trial_ends_at": new Date(Date.now()),
            
        
    
        
        
            
                "timezone": "Marie Curie",
            
        
    
        
        
            
                "default_currency": "Marie Curie",
            
        
    
        
        
            
                "primary_domain": "Alan Turing",
            
        
    
        
        
            
                "logo_url": "Alan Turing",
            
        
    
        
        
            
                "billing_email": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "slug": "Grace Hopper",
            
        
    
        
        
            
                "status": "suspended",
            
        
    
        
        
            
                "trial_ends_at": new Date(Date.now()),
            
        
    
        
        
            
                "timezone": "Ada Lovelace",
            
        
    
        
        
            
                "default_currency": "Marie Curie",
            
        
    
        
        
            
                "primary_domain": "Ada Lovelace",
            
        
    
        
        
            
                "logo_url": "Ada Lovelace",
            
        
    
        
        
            
                "billing_email": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "slug": "Grace Hopper",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "trial_ends_at": new Date(Date.now()),
            
        
    
        
        
            
                "timezone": "Grace Hopper",
            
        
    
        
        
            
                "default_currency": "Alan Turing",
            
        
    
        
        
            
                "primary_domain": "Alan Turing",
            
        
    
        
        
            
                "logo_url": "Grace Hopper",
            
        
    
        
        
            
                "billing_email": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "slug": "Grace Hopper",
            
        
    
        
        
            
                "status": "suspended",
            
        
    
        
        
            
                "trial_ends_at": new Date(Date.now()),
            
        
    
        
        
            
                "timezone": "Marie Curie",
            
        
    
        
        
            
                "default_currency": "Ada Lovelace",
            
        
    
        
        
            
                "primary_domain": "Alan Turing",
            
        
    
        
        
            
                "logo_url": "Marie Curie",
            
        
    
        
        
            
                "billing_email": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RolePermissionsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
    },
    
];



const PipelinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Default Sales Pipeline",
            
        
    
        
        
            
                "description": "Standard pipeline for inbound and outbound opportunities.",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Consulting Pipeline",
            
        
    
        
        
            
                "description": "Pipeline tailored for consulting engagements.",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Retail Partnerships",
            
        
    
        
        
            
                "description": "Partnership and vendor onboarding pipeline.",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Enterprise Deals",
            
        
    
        
        
            
                "description": "Long-cycle enterprise manufacturing deals.",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DealStagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Qualification",
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "win_probability": 0.1,
            
        
    
        
        
            
                "is_won": false,
            
        
    
        
        
            
                "is_lost": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Discovery",
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
        
        
            
                "win_probability": 0.25,
            
        
    
        
        
            
                "is_won": false,
            
        
    
        
        
            
                "is_lost": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Proposal",
            
        
    
        
        
            
                "sort_order": 3,
            
        
    
        
        
            
                "win_probability": 0.5,
            
        
    
        
        
            
                "is_won": true,
            
        
    
        
        
            
                "is_lost": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Negotiation",
            
        
    
        
        
            
                "sort_order": 4,
            
        
    
        
        
            
                "win_probability": 0.75,
            
        
    
        
        
            
                "is_won": true,
            
        
    
        
        
            
                "is_lost": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CompaniesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Redwood Analytics",
            
        
    
        
        
            
                "domain": "redwoodanalytics.com",
            
        
    
        
        
            
                "phone": "+1-650-555-0134",
            
        
    
        
        
            
                "website": "https://redwoodanalytics.com",
            
        
    
        
        
            
                "industry": "Software",
            
        
    
        
        
            
                "employee_count": 220,
            
        
    
        
        
            
                "annual_revenue": 18000000,
            
        
    
        
        
            
                "address_line1": "500 Market St",
            
        
    
        
        
            
                "address_line2": "Suite 1200",
            
        
    
        
        
            
                "city": "San Francisco",
            
        
    
        
        
            
                "state": "CA",
            
        
    
        
        
            
                "postal_code": "94105",
            
        
    
        
        
            
                "country": "USA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Interested in replacing legacy CRM and consolidating reporting.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Harbor Health Systems",
            
        
    
        
        
            
                "domain": "harborhealth.org",
            
        
    
        
        
            
                "phone": "+1-617-555-0192",
            
        
    
        
        
            
                "website": "https://harborhealth.org",
            
        
    
        
        
            
                "industry": "Healthcare",
            
        
    
        
        
            
                "employee_count": 1400,
            
        
    
        
        
            
                "annual_revenue": 260000000,
            
        
    
        
        
            
                "address_line1": "18 Beacon St",
            
        
    
        
        
            
                "address_line2": "Floor 6",
            
        
    
        
        
            
                "city": "Boston",
            
        
    
        
        
            
                "state": "MA",
            
        
    
        
        
            
                "postal_code": "02108",
            
        
    
        
        
            
                "country": "USA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Evaluating integration requirements and security posture.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Oxbridge Estates",
            
        
    
        
        
            
                "domain": "oxbridgeestates.co.uk",
            
        
    
        
        
            
                "phone": "+44 161 555 0130",
            
        
    
        
        
            
                "website": "https://oxbridgeestates.co.uk",
            
        
    
        
        
            
                "industry": "Real Estate",
            
        
    
        
        
            
                "employee_count": 85,
            
        
    
        
        
            
                "annual_revenue": 9500000,
            
        
    
        
        
            
                "address_line1": "12 King St",
            
        
    
        
        
            
                "address_line2": "Unit 3",
            
        
    
        
        
            
                "city": "Manchester",
            
        
    
        
        
            
                "state": "Greater Manchester",
            
        
    
        
        
            
                "postal_code": "M2 6AX",
            
        
    
        
        
            
                "country": "UK",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Warm referral from partner network.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Cascade Furnishings",
            
        
    
        
        
            
                "domain": "cascadefurnishings.com",
            
        
    
        
        
            
                "phone": "+1-206-555-0168",
            
        
    
        
        
            
                "website": "https://cascadefurnishings.com",
            
        
    
        
        
            
                "industry": "Retail",
            
        
    
        
        
            
                "employee_count": 410,
            
        
    
        
        
            
                "annual_revenue": 42000000,
            
        
    
        
        
            
                "address_line1": "77 Pike St",
            
        
    
        
        
            
                "address_line2": "Building B",
            
        
    
        
        
            
                "city": "Seattle",
            
        
    
        
        
            
                "state": "WA",
            
        
    
        
        
            
                "postal_code": "98101",
            
        
    
        
        
            
                "country": "USA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Expanding to new regions and reviewing vendor tooling.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ContactsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Ethan",
            
        
    
        
        
            
                "last_name": "Brooks",
            
        
    
        
        
            
                "email": "ethan.brooks@redwoodanalytics.com",
            
        
    
        
        
            
                "phone": "+1-650-555-0122",
            
        
    
        
        
            
                "job_title": "VP Sales Operations",
            
        
    
        
        
            
                "lifecycle_stage": "customer",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "linkedin_url": "https://www.linkedin.com/in/ethanbrooks",
            
        
    
        
        
            
                "notes": "Primary stakeholder for CRM evaluation.",
            
        
    
        
        
            
                "do_not_contact": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Nina",
            
        
    
        
        
            
                "last_name": "Klein",
            
        
    
        
        
            
                "email": "nina.klein@harborhealth.org",
            
        
    
        
        
            
                "phone": "+1-617-555-0171",
            
        
    
        
        
            
                "job_title": "Director of IT",
            
        
    
        
        
            
                "lifecycle_stage": "lead",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "linkedin_url": "https://www.linkedin.com/in/ninaklein",
            
        
    
        
        
            
                "notes": "Focused on compliance and access controls.",
            
        
    
        
        
            
                "do_not_contact": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Oliver",
            
        
    
        
        
            
                "last_name": "Grant",
            
        
    
        
        
            
                "email": "oliver.grant@oxbridgeestates.co.uk",
            
        
    
        
        
            
                "phone": "+44 161 555 0188",
            
        
    
        
        
            
                "job_title": "Head of Partnerships",
            
        
    
        
        
            
                "lifecycle_stage": "churned",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "linkedin_url": "https://www.linkedin.com/in/olivergrant",
            
        
    
        
        
            
                "notes": "Requested pricing and onboarding timeline.",
            
        
    
        
        
            
                "do_not_contact": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Priya",
            
        
    
        
        
            
                "last_name": "Nair",
            
        
    
        
        
            
                "email": "priya.nair@cascadefurnishings.com",
            
        
    
        
        
            
                "phone": "+1-206-555-0144",
            
        
    
        
        
            
                "job_title": "Procurement Manager",
            
        
    
        
        
            
                "lifecycle_stage": "prospect",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "linkedin_url": "https://www.linkedin.com/in/priyanair",
            
        
    
        
        
            
                "notes": "Wants weekly project updates during rollout.",
            
        
    
        
        
            
                "do_not_contact": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LeadsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "full_name": "Grace Morgan",
            
        
    
        
        
            
                "email": "grace.morgan@evercove.io",
            
        
    
        
        
            
                "phone": "+1-408-555-0177",
            
        
    
        
        
            
                "company_name": "Evercove",
            
        
    
        
        
            
                "job_title": "Founder",
            
        
    
        
        
            
                "lead_source": "referral",
            
        
    
        
        
            
                "status": "new",
            
        
    
        
        
            
                "score": 72.5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Submitted demo request via pricing page.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "full_name": "Henry Wallace",
            
        
    
        
        
            
                "email": "henry.wallace@springshore.com",
            
        
    
        
        
            
                "phone": "+1-312-555-0129",
            
        
    
        
        
            
                "company_name": "Springshore Logistics",
            
        
    
        
        
            
                "job_title": "Operations Manager",
            
        
    
        
        
            
                "lead_source": "event",
            
        
    
        
        
            
                "status": "qualified",
            
        
    
        
        
            
                "score": 58,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Referral from existing customer; asked about reporting exports.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "full_name": "Sophie Turner",
            
        
    
        
        
            
                "email": "sophie.turner@lintonholdings.co.uk",
            
        
    
        
        
            
                "phone": "+44 20 7946 0310",
            
        
    
        
        
            
                "company_name": "Linton Holdings",
            
        
    
        
        
            
                "job_title": "Business Development",
            
        
    
        
        
            
                "lead_source": "partner",
            
        
    
        
        
            
                "status": "converted",
            
        
    
        
        
            
                "score": 81,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Met at industry event; needs Google Calendar sync.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "full_name": "Daniel Kim",
            
        
    
        
        
            
                "email": "daniel.kim@northbayretail.com",
            
        
    
        
        
            
                "phone": "+1-415-555-0161",
            
        
    
        
        
            
                "company_name": "NorthBay Retail",
            
        
    
        
        
            
                "job_title": "Regional Manager",
            
        
    
        
        
            
                "lead_source": "ads",
            
        
    
        
        
            
                "status": "new",
            
        
    
        
        
            
                "score": 21,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Not a fit this quarter; budget paused.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DealsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Redwood Analytics CRM Rollout",
            
        
    
        
        
            
                "amount": 48000,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "expected_close_at": new Date('2026-05-10T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "loss_reason": "No decision",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": 2,
            
        
    
        
        
            
                "description": "CRM deployment for sales ops with dashboard KPIs and activity tracking.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Harbor Health Secure CRM",
            
        
    
        
        
            
                "amount": 125000,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "expected_close_at": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-04-02T00:00:00Z'),
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "loss_reason": "Procurement delay",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": 1,
            
        
    
        
        
            
                "description": "Security-focused rollout with RBAC and audit-friendly activity logs.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Oxbridge Estates Engagement",
            
        
    
        
        
            
                "amount": 32000,
            
        
    
        
        
            
                "currency": "GBP",
            
        
    
        
        
            
                "expected_close_at": new Date('2026-04-25T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-04-03T00:00:00Z'),
            
        
    
        
        
            
                "status": "won",
            
        
    
        
        
            
                "loss_reason": "Contract review",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": 3,
            
        
    
        
        
            
                "description": "CRM customization, import existing contacts, and calendar sync configuration.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Cascade Furnishings Vendor Enablement",
            
        
    
        
        
            
                "amount": 18000,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "expected_close_at": new Date('2026-05-05T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-04-04T00:00:00Z'),
            
        
    
        
        
            
                "status": "lost",
            
        
    
        
        
            
                "loss_reason": "Not applicable",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": 4,
            
        
    
        
        
            
                "description": "Standard pipeline tracking for partnerships and vendor onboarding.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ActivitiesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "activity_type": "status_change",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "subject": "Discovery call recap",
            
        
    
        
        
            
                "body": "Discussed current tools, reporting needs, and timeline. Next step is demo with sales ops team.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-04-06T16:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "activity_type": "call",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "subject": "Security questionnaire sent",
            
        
    
        
        
            
                "body": "Sent security and compliance questionnaire and requested SSO requirements details.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-04-06T12:30:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "activity_type": "system",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "subject": "Proposal walkthrough meeting",
            
        
    
        
        
            
                "body": "Reviewed proposal scope, milestones, and import plan. Waiting on feedback from finance.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-04-05T09:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "activity_type": "meeting",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "subject": "Stakeholder notes",
            
        
    
        
        
            
                "body": "Procurement prefers monthly invoicing. Need to confirm data fields for CSV import.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-04-04T18:10:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TasksData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Schedule product demo with sales ops",
            
        
    
        
        
            
                "description": "Coordinate calendars and invite key stakeholders. Include dashboard and API overview.",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "due_at": new Date('2026-04-10T15:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "is_overdue": 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "title": "Review security questionnaire responses",
            
        
    
        
        
            
                "description": "Validate RBAC needs and confirm data retention requirements.",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "due_at": new Date('2026-04-09T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-02T00:00:00Z'),
            
        
    
        
        
            
                "is_overdue": false,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "title": "Send revised statement of work",
            
        
    
        
        
            
                "description": "Update milestones and include CSV migration support option.",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "due_at": new Date('2026-04-08T10:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-03T00:00:00Z'),
            
        
    
        
        
            
                "is_overdue": 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "title": "Confirm required vendor fields for import",
            
        
    
        
        
            
                "description": "Collect columns and mapping preferences for CSV import template.",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "due_at": new Date('2026-04-11T20:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-04T00:00:00Z'),
            
        
    
        
        
            
                "is_overdue": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RemindersData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "message": "Follow up to confirm demo attendees and agenda.",
            
        
    
        
        
            
                "remind_at": new Date('2026-04-09T13:00:00Z'),
            
        
    
        
        
            
                "channel": "in_app",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "sent_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "message": "Send reminder to IT team for pending answers.",
            
        
    
        
        
            
                "remind_at": new Date('2026-04-08T16:00:00Z'),
            
        
    
        
        
            
                "channel": "in_app",
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                "sent_at": new Date('2026-04-02T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "message": "Nudge client to review updated SOW before Friday.",
            
        
    
        
        
            
                "remind_at": new Date('2026-04-08T08:30:00Z'),
            
        
    
        
        
            
                "channel": "in_app",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "sent_at": new Date('2026-04-03T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "message": "Request final CSV column list for import template.",
            
        
    
        
        
            
                "remind_at": new Date('2026-04-10T18:00:00Z'),
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "sent_at": new Date('2026-04-04T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EmailTemplatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Follow-up Reminder",
            
        
    
        
        
            
                "subject": "Reminder: Upcoming follow-up",
            
        
    
        
        
            
                "html_body": "<p>This is a reminder to follow up on your open items.</p>",
            
        
    
        
        
            
                "text_body": "This is a reminder to follow up on your open items.",
            
        
    
        
        
            
                "template_type": "custom",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Deal Stage Update",
            
        
    
        
        
            
                "subject": "Deal update: Stage changed",
            
        
    
        
        
            
                "html_body": "<p>The deal stage has been updated. Please review the details.</p>",
            
        
    
        
        
            
                "text_body": "The deal stage has been updated. Please review the details.",
            
        
    
        
        
            
                "template_type": "daily_digest",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Lead Assigned",
            
        
    
        
        
            
                "subject": "New lead assigned",
            
        
    
        
        
            
                "html_body": "<p>A new lead has been assigned to you. Please review and take action.</p>",
            
        
    
        
        
            
                "text_body": "A new lead has been assigned to you. Please review and take action.",
            
        
    
        
        
            
                "template_type": "daily_digest",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Daily Digest",
            
        
    
        
        
            
                "subject": "Daily CRM digest",
            
        
    
        
        
            
                "html_body": "<p>Here is your daily summary of tasks, reminders, and updates.</p>",
            
        
    
        
        
            
                "text_body": "Here is your daily summary of tasks, reminders, and updates.",
            
        
    
        
        
            
                "template_type": "custom",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EmailNotificationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "to_address": "jordan.lee@northstar.example.com",
            
        
    
        
        
            
                "subject": "Reminder: Upcoming follow-up",
            
        
    
        
        
            
                "body_preview": "This is a reminder to follow up on your open items.",
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "queued_at": new Date('2026-04-06T16:05:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "to_address": "aisha.patel@northstar.example.com",
            
        
    
        
        
            
                "subject": "Deal update: Stage changed",
            
        
    
        
        
            
                "body_preview": "The deal stage has been updated. Please review the details.",
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "queued_at": new Date('2026-04-05T11:00:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-04-05T11:00:30Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "to_address": "sam.wright@bluepeak.example.co.uk",
            
        
    
        
        
            
                "subject": "New lead assigned",
            
        
    
        
        
            
                "body_preview": "A new lead has been assigned to you. Please review and take action.",
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "queued_at": new Date('2026-04-05T08:10:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-04-05T08:10:20Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "to_address": "elena.garcia@sunrise.example.com",
            
        
    
        
        
            
                "subject": "Daily CRM digest",
            
        
    
        
        
            
                "body_preview": "Here is your daily summary of tasks, reminders, and updates.",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "queued_at": new Date('2026-04-06T07:00:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-04-06T07:00:25Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ImportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "leads",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "mapping_json": "{email:email,first_name:first_name,last_name:last_name}",
            
        
    
        
        
            
                "total_rows": 250,
            
        
    
        
        
            
                "processed_rows": 250,
            
        
    
        
        
            
                "success_rows": 245,
            
        
    
        
        
            
                "error_rows": 5,
            
        
    
        
        
            
                "error_report": "5 rows missing email address",
            
        
    
        
        
            
                "started_at": new Date('2026-04-01T14:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-01T14:03:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "leads",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "mapping_json": "{name:name,domain:domain}",
            
        
    
        
        
            
                "total_rows": 60,
            
        
    
        
        
            
                "processed_rows": 60,
            
        
    
        
        
            
                "success_rows": 60,
            
        
    
        
        
            
                "error_rows": 0,
            
        
    
        
        
            
                "error_report": "",
            
        
    
        
        
            
                "started_at": new Date('2026-04-02T09:10:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-02T09:11:30Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "leads",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "mapping_json": "{full_name:full_name,email:email}",
            
        
    
        
        
            
                "total_rows": 120,
            
        
    
        
        
            
                "processed_rows": 45,
            
        
    
        
        
            
                "success_rows": 44,
            
        
    
        
        
            
                "error_rows": 1,
            
        
    
        
        
            
                "error_report": "1 row invalid email format",
            
        
    
        
        
            
                "started_at": new Date('2026-04-06T18:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "deals",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "mapping_json": "{name:name,amount:amount}",
            
        
    
        
        
            
                "total_rows": 35,
            
        
    
        
        
            
                "processed_rows": 12,
            
        
    
        
        
            
                "success_rows": 10,
            
        
    
        
        
            
                "error_rows": 2,
            
        
    
        
        
            
                "error_report": "2 rows missing currency value",
            
        
    
        
        
            
                "started_at": new Date('2026-04-03T07:30:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-03T07:31:10Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ExportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "companies",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "filters_json": "{status:open}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "total_rows": 42,
            
        
    
        
        
            
                "started_at": new Date('2026-04-05T16:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-05T16:00:40Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "tasks",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "filters_json": "{lifecycle_stage:lead}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "total_rows": 18,
            
        
    
        
        
            
                "started_at": new Date('2026-04-04T10:15:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-04T10:15:12Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "activities",
            
        
    
        
        
            
                "status": "processing",
            
        
    
        
        
            
                "filters_json": "{status:active}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "total_rows": 0,
            
        
    
        
        
            
                "started_at": new Date('2026-04-06T07:10:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "failure_reason": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "tasks",
            
        
    
        
        
            
                "status": "processing",
            
        
    
        
        
            
                "filters_json": "{activity_type:meeting}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "total_rows": 0,
            
        
    
        
        
            
                "started_at": new Date('2026-04-03T08:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-04-03T08:00:05Z'),
            
        
    
        
        
            
                "failure_reason": "Export job crashed during serialization",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ApiClientsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Northstar Zap Automations",
            
        
    
        
        
            
                "client_key": "ns_zap_01",
            
        
    
        
        
            
                "client_secret_hash": "hash_9f1a7c",
            
        
    
        
        
            
                "status": "revoked",
            
        
    
        
        
            
                "last_used_at": new Date('2026-04-06T12:00:00Z'),
            
        
    
        
        
            
                "allowed_ips": "34.120.10.0/24",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "BluePeak Data Warehouse",
            
        
    
        
        
            
                "client_key": "bp_dwh_01",
            
        
    
        
        
            
                "client_secret_hash": "hash_1c3d88",
            
        
    
        
        
            
                "status": "revoked",
            
        
    
        
        
            
                "last_used_at": new Date('2026-04-06T09:30:00Z'),
            
        
    
        
        
            
                "allowed_ips": "18.200.5.10",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Sunrise Reporting Bot",
            
        
    
        
        
            
                "client_key": "sr_bot_01",
            
        
    
        
        
            
                "client_secret_hash": "hash_a20b11",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "last_used_at": new Date('2026-03-25T17:20:00Z'),
            
        
    
        
        
            
                "allowed_ips": "52.10.22.15",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Helio ERP Sync",
            
        
    
        
        
            
                "client_key": "hm_erp_01",
            
        
    
        
        
            
                "client_secret_hash": "hash_7aa04e",
            
        
    
        
        
            
                "status": "revoked",
            
        
    
        
        
            
                "last_used_at": new Date('2026-04-05T06:10:00Z'),
            
        
    
        
        
            
                "allowed_ips": "203.0.113.10",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ApiTokensData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "token_hash": "tokhash_001_ns",
            
        
    
        
        
            
                "expires_at": new Date('2026-07-01T00:00:00Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "last_used_at": new Date('2026-04-06T12:01:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "token_hash": "tokhash_002_bp",
            
        
    
        
        
            
                "expires_at": new Date('2026-06-15T00:00:00Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "last_used_at": new Date('2026-04-06T09:31:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "token_hash": "tokhash_003_sr",
            
        
    
        
        
            
                "expires_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "last_used_at": new Date('2026-03-25T17:20:10Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "token_hash": "tokhash_004_hm",
            
        
    
        
        
            
                "expires_at": new Date('2026-08-01T00:00:00Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "last_used_at": new Date('2026-04-05T06:11:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WebhooksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Deal Updates Webhook",
            
        
    
        
        
            
                "target_url": "https://hooks.example.com/northstar/deals",
            
        
    
        
        
            
                "secret": "ns_deals_secret_01",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "event_types": "deals.created,deals.updated,deals.won,deals.lost",
            
        
    
        
        
            
                "timeout_seconds": 10,
            
        
    
        
        
            
                "max_retries": 5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Lead Routing Webhook",
            
        
    
        
        
            
                "target_url": "https://hooks.example.com/bluepeak/leads",
            
        
    
        
        
            
                "secret": "bp_leads_secret_01",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "event_types": "leads.created,leads.updated",
            
        
    
        
        
            
                "timeout_seconds": 10,
            
        
    
        
        
            
                "max_retries": 3,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Task Completion Webhook",
            
        
    
        
        
            
                "target_url": "https://hooks.example.com/sunrise/tasks",
            
        
    
        
        
            
                "secret": "sr_tasks_secret_01",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "event_types": "tasks.completed",
            
        
    
        
        
            
                "timeout_seconds": 8,
            
        
    
        
        
            
                "max_retries": 3,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "ERP Sync Webhook",
            
        
    
        
        
            
                "target_url": "https://erp.helio.example.de/webhooks/crm",
            
        
    
        
        
            
                "secret": "hm_erp_secret_01",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "event_types": "deals.updated,activities.created,tasks.completed",
            
        
    
        
        
            
                "timeout_seconds": 15,
            
        
    
        
        
            
                "max_retries": 6,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WebhookDeliveriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "deals.updated",
            
        
    
        
        
            
                "payload_json": "{deal:Redwood Analytics CRM Rollout,status:open}",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "http_status": 200,
            
        
    
        
        
            
                "response_body": "ok",
            
        
    
        
        
            
                "next_attempt_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-04-06T16:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "leads.created",
            
        
    
        
        
            
                "payload_json": "{lead:Sophie Turner,source:event}",
            
        
    
        
        
            
                "status": "success",
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "http_status": 202,
            
        
    
        
        
            
                "response_body": "accepted",
            
        
    
        
        
            
                "next_attempt_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-04-05T08:12:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "tasks.completed",
            
        
    
        
        
            
                "payload_json": "{task:Confirm required vendor fields for import}",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "attempt_count": 3,
            
        
    
        
        
            
                "http_status": 500,
            
        
    
        
        
            
                "response_body": "server_error",
            
        
    
        
        
            
                "next_attempt_at": new Date('2026-04-07T07:30:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "activities.created",
            
        
    
        
        
            
                "payload_json": "{activity:Webhook requirements follow-up}",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "http_status": 200,
            
        
    
        
        
            
                "response_body": "synced",
            
        
    
        
        
            
                "next_attempt_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-04-06T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const IntegrationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "google_calendar",
            
        
    
        
        
            
                "name": "Google Calendar Sync",
            
        
    
        
        
            
                "status": "disconnected",
            
        
    
        
        
            
                "config_json": "{syncDirection:two_way}",
            
        
    
        
        
            
                "connected_at": new Date('2026-03-20T12:00:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-04-06T12:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "smtp",
            
        
    
        
        
            
                "name": "SMTP Relay",
            
        
    
        
        
            
                "status": "error",
            
        
    
        
        
            
                "config_json": "{host:smtp.bluepeak.example.co.uk,port:587}",
            
        
    
        
        
            
                "connected_at": new Date('2026-03-22T09:00:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-04-06T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "google_calendar",
            
        
    
        
        
            
                "name": "SendGrid Notifications",
            
        
    
        
        
            
                "status": "error",
            
        
    
        
        
            
                "config_json": "{apiKeyRef:sendgrid_key_01}",
            
        
    
        
        
            
                "connected_at": new Date('2026-03-10T08:00:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-04-02T07:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "sendgrid",
            
        
    
        
        
            
                "name": "Executive Calendar Sync",
            
        
    
        
        
            
                "status": "connected",
            
        
    
        
        
            
                "config_json": "{syncDirection:one_way}",
            
        
    
        
        
            
                "connected_at": new Date('2026-03-25T15:30:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-04-05T06:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CalendarAccountsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_account_email": "jordan.lee@northstar.example.com",
            
        
    
        
        
            
                "access_token_encrypted": "enc_access_001",
            
        
    
        
        
            
                "refresh_token_encrypted": "enc_refresh_001",
            
        
    
        
        
            
                "token_expires_at": new Date('2026-04-07T12:00:00Z'),
            
        
    
        
        
            
                "sync_status": "error",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-06T12:05:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "provider_account_email": "aisha.patel@northstar.example.com",
            
        
    
        
        
            
                "access_token_encrypted": "enc_access_002",
            
        
    
        
        
            
                "refresh_token_encrypted": "enc_refresh_002",
            
        
    
        
        
            
                "token_expires_at": new Date('2026-04-07T12:10:00Z'),
            
        
    
        
        
            
                "sync_status": "enabled",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-06T12:06:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "provider_account_email": "sam.wright@bluepeak.example.co.uk",
            
        
    
        
        
            
                "access_token_encrypted": "enc_access_003",
            
        
    
        
        
            
                "refresh_token_encrypted": "enc_refresh_003",
            
        
    
        
        
            
                "token_expires_at": new Date('2026-04-20T00:00:00Z'),
            
        
    
        
        
            
                "sync_status": "enabled",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "provider_account_email": "maria.chen@northstar.example.com",
            
        
    
        
        
            
                "access_token_encrypted": "enc_access_004",
            
        
    
        
        
            
                "refresh_token_encrypted": "enc_refresh_004",
            
        
    
        
        
            
                "token_expires_at": new Date('2026-04-07T08:00:00Z'),
            
        
    
        
        
            
                "sync_status": "enabled",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-05T06:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CalendarEventsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_event_id": "gcal_evt_001",
            
        
    
        
        
            
                "title": "Redwood demo",
            
        
    
        
        
            
                "description": "Product demo covering pipeline, dashboards, and API.",
            
        
    
        
        
            
                "start_at": new Date('2026-04-10T15:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-04-10T15:30:00Z'),
            
        
    
        
        
            
                "location": "Google Meet",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-06T12:05:30Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_event_id": "gcal_evt_002",
            
        
    
        
        
            
                "title": "Security review session",
            
        
    
        
        
            
                "description": "Review security questionnaire and SSO requirements.",
            
        
    
        
        
            
                "start_at": new Date('2026-04-09T17:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-04-09T17:45:00Z'),
            
        
    
        
        
            
                "location": "Zoom",
            
        
    
        
        
            
                "status": "tentative",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-06T12:06:15Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_event_id": "gcal_evt_003",
            
        
    
        
        
            
                "title": "Oxbridge SOW review",
            
        
    
        
        
            
                "description": "Internal review of revised statement of work before sending.",
            
        
    
        
        
            
                "start_at": new Date('2026-04-08T09:30:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-04-08T10:00:00Z'),
            
        
    
        
        
            
                "location": "Office",
            
        
    
        
        
            
                "status": "tentative",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_event_id": "gcal_evt_004",
            
        
    
        
        
            
                "title": "Vendor data fields call",
            
        
    
        
        
            
                "description": "Confirm CSV import fields and mapping.",
            
        
    
        
        
            
                "start_at": new Date('2026-04-11T20:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-04-11T20:30:00Z'),
            
        
    
        
        
            
                "location": "Phone",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "last_synced_at": new Date('2026-04-02T07:00:30Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DashboardWidgetsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Open Deals KPI",
            
        
    
        
        
            
                "widget_type": "table",
            
        
    
        
        
            
                "config_json": "{metric:open_deals_count}",
            
        
    
        
        
            
                "position_x": 0,
            
        
    
        
        
            
                "position_y": 0,
            
        
    
        
        
            
                "width": 4,
            
        
    
        
        
            
                "height": 2,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Pipeline Funnel",
            
        
    
        
        
            
                "widget_type": "chart",
            
        
    
        
        
            
                "config_json": "{pipeline:Default Sales Pipeline}",
            
        
    
        
        
            
                "position_x": 4,
            
        
    
        
        
            
                "position_y": 0,
            
        
    
        
        
            
                "width": 8,
            
        
    
        
        
            
                "height": 4,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Activities Feed",
            
        
    
        
        
            
                "widget_type": "chart",
            
        
    
        
        
            
                "config_json": "{limit:20}",
            
        
    
        
        
            
                "position_x": 0,
            
        
    
        
        
            
                "position_y": 0,
            
        
    
        
        
            
                "width": 12,
            
        
    
        
        
            
                "height": 4,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Tasks Due This Week",
            
        
    
        
        
            
                "widget_type": "funnel",
            
        
    
        
        
            
                "config_json": "{filter:due_this_week}",
            
        
    
        
        
            
                "position_x": 0,
            
        
    
        
        
            
                "position_y": 4,
            
        
    
        
        
            
                "width": 6,
            
        
    
        
        
            
                "height": 3,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // 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);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User3 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (User3?.setOrganization)
                {
                    await
                    User3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTenantWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant0 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Tenant0?.setOrganization)
                {
                    await
                    Tenant0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant1 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Tenant1?.setOrganization)
                {
                    await
                    Tenant1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant2 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Tenant2?.setOrganization)
                {
                    await
                    Tenant2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant3 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Tenant3?.setOrganization)
                {
                    await
                    Tenant3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateRolePermissionWithPermission() {
            
                const relatedPermission0 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission0 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RolePermission0?.setPermission)
                {
                    await
                    RolePermission0.
                    setPermission(relatedPermission0);
                }
            
                const relatedPermission1 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission1 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RolePermission1?.setPermission)
                {
                    await
                    RolePermission1.
                    setPermission(relatedPermission1);
                }
            
                const relatedPermission2 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission2 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RolePermission2?.setPermission)
                {
                    await
                    RolePermission2.
                    setPermission(relatedPermission2);
                }
            
                const relatedPermission3 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission3 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RolePermission3?.setPermission)
                {
                    await
                    RolePermission3.
                    setPermission(relatedPermission3);
                }
            
        }
        
    
        
            
            async function associateRolePermissionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission0 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RolePermission0?.setOrganization)
                {
                    await
                    RolePermission0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission1 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RolePermission1?.setOrganization)
                {
                    await
                    RolePermission1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission2 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RolePermission2?.setOrganization)
                {
                    await
                    RolePermission2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission3 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RolePermission3?.setOrganization)
                {
                    await
                    RolePermission3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePipelineWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Pipeline0 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Pipeline0?.setTenant)
                {
                    await
                    Pipeline0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Pipeline1 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Pipeline1?.setTenant)
                {
                    await
                    Pipeline1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Pipeline2 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Pipeline2?.setTenant)
                {
                    await
                    Pipeline2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Pipeline3 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Pipeline3?.setTenant)
                {
                    await
                    Pipeline3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePipelineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Pipeline0 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Pipeline0?.setOrganization)
                {
                    await
                    Pipeline0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Pipeline1 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Pipeline1?.setOrganization)
                {
                    await
                    Pipeline1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Pipeline2 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Pipeline2?.setOrganization)
                {
                    await
                    Pipeline2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Pipeline3 = await Pipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Pipeline3?.setOrganization)
                {
                    await
                    Pipeline3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDealStageWithPipeline() {
            
                const relatedPipeline0 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const DealStage0 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DealStage0?.setPipeline)
                {
                    await
                    DealStage0.
                    setPipeline(relatedPipeline0);
                }
            
                const relatedPipeline1 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const DealStage1 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DealStage1?.setPipeline)
                {
                    await
                    DealStage1.
                    setPipeline(relatedPipeline1);
                }
            
                const relatedPipeline2 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const DealStage2 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DealStage2?.setPipeline)
                {
                    await
                    DealStage2.
                    setPipeline(relatedPipeline2);
                }
            
                const relatedPipeline3 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const DealStage3 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DealStage3?.setPipeline)
                {
                    await
                    DealStage3.
                    setPipeline(relatedPipeline3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDealStageWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DealStage0 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DealStage0?.setOrganization)
                {
                    await
                    DealStage0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DealStage1 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DealStage1?.setOrganization)
                {
                    await
                    DealStage1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DealStage2 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DealStage2?.setOrganization)
                {
                    await
                    DealStage2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DealStage3 = await DealStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DealStage3?.setOrganization)
                {
                    await
                    DealStage3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCompanyWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setTenant)
                {
                    await
                    Company0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setTenant)
                {
                    await
                    Company1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setTenant)
                {
                    await
                    Company2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Company3 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Company3?.setTenant)
                {
                    await
                    Company3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCompanyWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setOwner)
                {
                    await
                    Company0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setOwner)
                {
                    await
                    Company1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setOwner)
                {
                    await
                    Company2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company3 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Company3?.setOwner)
                {
                    await
                    Company3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateCompanyWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setOrganization)
                {
                    await
                    Company0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setOrganization)
                {
                    await
                    Company1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setOrganization)
                {
                    await
                    Company2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company3 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Company3?.setOrganization)
                {
                    await
                    Company3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateContactWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setTenant)
                {
                    await
                    Contact0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setTenant)
                {
                    await
                    Contact1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setTenant)
                {
                    await
                    Contact2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setTenant)
                {
                    await
                    Contact3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateContactWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setCompany)
                {
                    await
                    Contact0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setCompany)
                {
                    await
                    Contact1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setCompany)
                {
                    await
                    Contact2.
                    setCompany(relatedCompany2);
                }
            
                const relatedCompany3 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setCompany)
                {
                    await
                    Contact3.
                    setCompany(relatedCompany3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateContactWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setOwner)
                {
                    await
                    Contact0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setOwner)
                {
                    await
                    Contact1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setOwner)
                {
                    await
                    Contact2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setOwner)
                {
                    await
                    Contact3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateContactWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setOrganization)
                {
                    await
                    Contact0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setOrganization)
                {
                    await
                    Contact1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setOrganization)
                {
                    await
                    Contact2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setOrganization)
                {
                    await
                    Contact3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLeadWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setTenant)
                {
                    await
                    Lead0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setTenant)
                {
                    await
                    Lead1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setTenant)
                {
                    await
                    Lead2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Lead3 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lead3?.setTenant)
                {
                    await
                    Lead3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLeadWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setOwner)
                {
                    await
                    Lead0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setOwner)
                {
                    await
                    Lead1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setOwner)
                {
                    await
                    Lead2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead3 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lead3?.setOwner)
                {
                    await
                    Lead3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
            
            async function associateLeadWithConverted_contact() {
            
                const relatedConverted_contact0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setConverted_contact)
                {
                    await
                    Lead0.
                    setConverted_contact(relatedConverted_contact0);
                }
            
                const relatedConverted_contact1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setConverted_contact)
                {
                    await
                    Lead1.
                    setConverted_contact(relatedConverted_contact1);
                }
            
                const relatedConverted_contact2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setConverted_contact)
                {
                    await
                    Lead2.
                    setConverted_contact(relatedConverted_contact2);
                }
            
                const relatedConverted_contact3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Lead3 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lead3?.setConverted_contact)
                {
                    await
                    Lead3.
                    setConverted_contact(relatedConverted_contact3);
                }
            
        }
        
    
        
            
            async function associateLeadWithConverted_company() {
            
                const relatedConverted_company0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setConverted_company)
                {
                    await
                    Lead0.
                    setConverted_company(relatedConverted_company0);
                }
            
                const relatedConverted_company1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setConverted_company)
                {
                    await
                    Lead1.
                    setConverted_company(relatedConverted_company1);
                }
            
                const relatedConverted_company2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setConverted_company)
                {
                    await
                    Lead2.
                    setConverted_company(relatedConverted_company2);
                }
            
                const relatedConverted_company3 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead3 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lead3?.setConverted_company)
                {
                    await
                    Lead3.
                    setConverted_company(relatedConverted_company3);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lead3 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lead3?.setOrganization)
                {
                    await
                    Lead3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDealWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setTenant)
                {
                    await
                    Deal0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setTenant)
                {
                    await
                    Deal1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setTenant)
                {
                    await
                    Deal2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setTenant)
                {
                    await
                    Deal3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateDealWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setCompany)
                {
                    await
                    Deal0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setCompany)
                {
                    await
                    Deal1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setCompany)
                {
                    await
                    Deal2.
                    setCompany(relatedCompany2);
                }
            
                const relatedCompany3 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setCompany)
                {
                    await
                    Deal3.
                    setCompany(relatedCompany3);
                }
            
        }
        
    
        
            
            async function associateDealWithPrimary_contact() {
            
                const relatedPrimary_contact0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setPrimary_contact)
                {
                    await
                    Deal0.
                    setPrimary_contact(relatedPrimary_contact0);
                }
            
                const relatedPrimary_contact1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setPrimary_contact)
                {
                    await
                    Deal1.
                    setPrimary_contact(relatedPrimary_contact1);
                }
            
                const relatedPrimary_contact2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setPrimary_contact)
                {
                    await
                    Deal2.
                    setPrimary_contact(relatedPrimary_contact2);
                }
            
                const relatedPrimary_contact3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setPrimary_contact)
                {
                    await
                    Deal3.
                    setPrimary_contact(relatedPrimary_contact3);
                }
            
        }
        
    
        
            
            async function associateDealWithPipeline() {
            
                const relatedPipeline0 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setPipeline)
                {
                    await
                    Deal0.
                    setPipeline(relatedPipeline0);
                }
            
                const relatedPipeline1 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setPipeline)
                {
                    await
                    Deal1.
                    setPipeline(relatedPipeline1);
                }
            
                const relatedPipeline2 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setPipeline)
                {
                    await
                    Deal2.
                    setPipeline(relatedPipeline2);
                }
            
                const relatedPipeline3 = await Pipelines.findOne({
                    offset: Math.floor(Math.random() * (await Pipelines.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setPipeline)
                {
                    await
                    Deal3.
                    setPipeline(relatedPipeline3);
                }
            
        }
        
    
        
            
            async function associateDealWithStage() {
            
                const relatedStage0 = await DealStages.findOne({
                    offset: Math.floor(Math.random() * (await DealStages.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setStage)
                {
                    await
                    Deal0.
                    setStage(relatedStage0);
                }
            
                const relatedStage1 = await DealStages.findOne({
                    offset: Math.floor(Math.random() * (await DealStages.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setStage)
                {
                    await
                    Deal1.
                    setStage(relatedStage1);
                }
            
                const relatedStage2 = await DealStages.findOne({
                    offset: Math.floor(Math.random() * (await DealStages.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setStage)
                {
                    await
                    Deal2.
                    setStage(relatedStage2);
                }
            
                const relatedStage3 = await DealStages.findOne({
                    offset: Math.floor(Math.random() * (await DealStages.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setStage)
                {
                    await
                    Deal3.
                    setStage(relatedStage3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDealWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setOwner)
                {
                    await
                    Deal0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setOwner)
                {
                    await
                    Deal1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setOwner)
                {
                    await
                    Deal2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setOwner)
                {
                    await
                    Deal3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateDealWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Deal0 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Deal0?.setOrganization)
                {
                    await
                    Deal0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Deal1 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Deal1?.setOrganization)
                {
                    await
                    Deal1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Deal2 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Deal2?.setOrganization)
                {
                    await
                    Deal2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Deal3 = await Deals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Deal3?.setOrganization)
                {
                    await
                    Deal3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateActivityWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setTenant)
                {
                    await
                    Activity0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setTenant)
                {
                    await
                    Activity1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setTenant)
                {
                    await
                    Activity2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setTenant)
                {
                    await
                    Activity3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateActivityWithActor() {
            
                const relatedActor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setActor)
                {
                    await
                    Activity0.
                    setActor(relatedActor0);
                }
            
                const relatedActor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setActor)
                {
                    await
                    Activity1.
                    setActor(relatedActor1);
                }
            
                const relatedActor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setActor)
                {
                    await
                    Activity2.
                    setActor(relatedActor2);
                }
            
                const relatedActor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setActor)
                {
                    await
                    Activity3.
                    setActor(relatedActor3);
                }
            
        }
        
    
        
    
        
            
            async function associateActivityWithLead() {
            
                const relatedLead0 = await Leads.findOne({
                    offset: Math.floor(Math.random() * (await Leads.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setLead)
                {
                    await
                    Activity0.
                    setLead(relatedLead0);
                }
            
                const relatedLead1 = await Leads.findOne({
                    offset: Math.floor(Math.random() * (await Leads.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setLead)
                {
                    await
                    Activity1.
                    setLead(relatedLead1);
                }
            
                const relatedLead2 = await Leads.findOne({
                    offset: Math.floor(Math.random() * (await Leads.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setLead)
                {
                    await
                    Activity2.
                    setLead(relatedLead2);
                }
            
                const relatedLead3 = await Leads.findOne({
                    offset: Math.floor(Math.random() * (await Leads.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setLead)
                {
                    await
                    Activity3.
                    setLead(relatedLead3);
                }
            
        }
        
    
        
            
            async function associateActivityWithContact() {
            
                const relatedContact0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setContact)
                {
                    await
                    Activity0.
                    setContact(relatedContact0);
                }
            
                const relatedContact1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setContact)
                {
                    await
                    Activity1.
                    setContact(relatedContact1);
                }
            
                const relatedContact2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setContact)
                {
                    await
                    Activity2.
                    setContact(relatedContact2);
                }
            
                const relatedContact3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setContact)
                {
                    await
                    Activity3.
                    setContact(relatedContact3);
                }
            
        }
        
    
        
            
            async function associateActivityWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setCompany)
                {
                    await
                    Activity0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setCompany)
                {
                    await
                    Activity1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setCompany)
                {
                    await
                    Activity2.
                    setCompany(relatedCompany2);
                }
            
                const relatedCompany3 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setCompany)
                {
                    await
                    Activity3.
                    setCompany(relatedCompany3);
                }
            
        }
        
    
        
            
            async function associateActivityWithDeal() {
            
                const relatedDeal0 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setDeal)
                {
                    await
                    Activity0.
                    setDeal(relatedDeal0);
                }
            
                const relatedDeal1 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setDeal)
                {
                    await
                    Activity1.
                    setDeal(relatedDeal1);
                }
            
                const relatedDeal2 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setDeal)
                {
                    await
                    Activity2.
                    setDeal(relatedDeal2);
                }
            
                const relatedDeal3 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setDeal)
                {
                    await
                    Activity3.
                    setDeal(relatedDeal3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateActivityWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setOrganization)
                {
                    await
                    Activity0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setOrganization)
                {
                    await
                    Activity1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setOrganization)
                {
                    await
                    Activity2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Activity3 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Activity3?.setOrganization)
                {
                    await
                    Activity3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTaskWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setTenant)
                {
                    await
                    Task0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setTenant)
                {
                    await
                    Task1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setTenant)
                {
                    await
                    Task2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setTenant)
                {
                    await
                    Task3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateTaskWithAssignee() {
            
                const relatedAssignee0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setAssignee)
                {
                    await
                    Task0.
                    setAssignee(relatedAssignee0);
                }
            
                const relatedAssignee1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setAssignee)
                {
                    await
                    Task1.
                    setAssignee(relatedAssignee1);
                }
            
                const relatedAssignee2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setAssignee)
                {
                    await
                    Task2.
                    setAssignee(relatedAssignee2);
                }
            
                const relatedAssignee3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setAssignee)
                {
                    await
                    Task3.
                    setAssignee(relatedAssignee3);
                }
            
        }
        
    
        
            
            async function associateTaskWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setCreated_by_user)
                {
                    await
                    Task0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setCreated_by_user)
                {
                    await
                    Task1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setCreated_by_user)
                {
                    await
                    Task2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setCreated_by_user)
                {
                    await
                    Task3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedLead3 = await Leads.findOne({
                    offset: Math.floor(Math.random() * (await Leads.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setLead)
                {
                    await
                    Task3.
                    setLead(relatedLead3);
                }
            
        }
        
    
        
            
            async function associateTaskWithContact() {
            
                const relatedContact0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setContact)
                {
                    await
                    Task0.
                    setContact(relatedContact0);
                }
            
                const relatedContact1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setContact)
                {
                    await
                    Task1.
                    setContact(relatedContact1);
                }
            
                const relatedContact2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setContact)
                {
                    await
                    Task2.
                    setContact(relatedContact2);
                }
            
                const relatedContact3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setContact)
                {
                    await
                    Task3.
                    setContact(relatedContact3);
                }
            
        }
        
    
        
            
            async function associateTaskWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setCompany)
                {
                    await
                    Task0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setCompany)
                {
                    await
                    Task1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setCompany)
                {
                    await
                    Task2.
                    setCompany(relatedCompany2);
                }
            
                const relatedCompany3 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setCompany)
                {
                    await
                    Task3.
                    setCompany(relatedCompany3);
                }
            
        }
        
    
        
            
            async function associateTaskWithDeal() {
            
                const relatedDeal0 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setDeal)
                {
                    await
                    Task0.
                    setDeal(relatedDeal0);
                }
            
                const relatedDeal1 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setDeal)
                {
                    await
                    Task1.
                    setDeal(relatedDeal1);
                }
            
                const relatedDeal2 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setDeal)
                {
                    await
                    Task2.
                    setDeal(relatedDeal2);
                }
            
                const relatedDeal3 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setDeal)
                {
                    await
                    Task3.
                    setDeal(relatedDeal3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setOrganization)
                {
                    await
                    Task3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReminderWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Reminder0 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Reminder0?.setTenant)
                {
                    await
                    Reminder0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Reminder1 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Reminder1?.setTenant)
                {
                    await
                    Reminder1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Reminder2 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Reminder2?.setTenant)
                {
                    await
                    Reminder2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Reminder3 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Reminder3?.setTenant)
                {
                    await
                    Reminder3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateReminderWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Reminder0 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Reminder0?.setUser)
                {
                    await
                    Reminder0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Reminder1 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Reminder1?.setUser)
                {
                    await
                    Reminder1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Reminder2 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Reminder2?.setUser)
                {
                    await
                    Reminder2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Reminder3 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Reminder3?.setUser)
                {
                    await
                    Reminder3.
                    setUser(relatedUser3);
                }
            
        }
        
    
        
            
            async function associateReminderWithTask() {
            
                const relatedTask0 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Reminder0 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Reminder0?.setTask)
                {
                    await
                    Reminder0.
                    setTask(relatedTask0);
                }
            
                const relatedTask1 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Reminder1 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Reminder1?.setTask)
                {
                    await
                    Reminder1.
                    setTask(relatedTask1);
                }
            
                const relatedTask2 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Reminder2 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Reminder2?.setTask)
                {
                    await
                    Reminder2.
                    setTask(relatedTask2);
                }
            
                const relatedTask3 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Reminder3 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Reminder3?.setTask)
                {
                    await
                    Reminder3.
                    setTask(relatedTask3);
                }
            
        }
        
    
        
            
            async function associateReminderWithDeal() {
            
                const relatedDeal0 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Reminder0 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Reminder0?.setDeal)
                {
                    await
                    Reminder0.
                    setDeal(relatedDeal0);
                }
            
                const relatedDeal1 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Reminder1 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Reminder1?.setDeal)
                {
                    await
                    Reminder1.
                    setDeal(relatedDeal1);
                }
            
                const relatedDeal2 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Reminder2 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Reminder2?.setDeal)
                {
                    await
                    Reminder2.
                    setDeal(relatedDeal2);
                }
            
                const relatedDeal3 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const Reminder3 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Reminder3?.setDeal)
                {
                    await
                    Reminder3.
                    setDeal(relatedDeal3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReminderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Reminder0 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Reminder0?.setOrganization)
                {
                    await
                    Reminder0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Reminder1 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Reminder1?.setOrganization)
                {
                    await
                    Reminder1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Reminder2 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Reminder2?.setOrganization)
                {
                    await
                    Reminder2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Reminder3 = await Reminders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Reminder3?.setOrganization)
                {
                    await
                    Reminder3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEmailTemplateWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailTemplate0 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailTemplate0?.setTenant)
                {
                    await
                    EmailTemplate0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailTemplate1 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailTemplate1?.setTenant)
                {
                    await
                    EmailTemplate1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailTemplate2 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailTemplate2?.setTenant)
                {
                    await
                    EmailTemplate2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailTemplate3 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EmailTemplate3?.setTenant)
                {
                    await
                    EmailTemplate3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEmailTemplateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailTemplate0 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailTemplate0?.setOrganization)
                {
                    await
                    EmailTemplate0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailTemplate1 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailTemplate1?.setOrganization)
                {
                    await
                    EmailTemplate1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailTemplate2 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailTemplate2?.setOrganization)
                {
                    await
                    EmailTemplate2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailTemplate3 = await EmailTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EmailTemplate3?.setOrganization)
                {
                    await
                    EmailTemplate3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEmailNotificationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setTenant)
                {
                    await
                    EmailNotification0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setTenant)
                {
                    await
                    EmailNotification1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setTenant)
                {
                    await
                    EmailNotification2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const EmailNotification3 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EmailNotification3?.setTenant)
                {
                    await
                    EmailNotification3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateEmailNotificationWithRecipient() {
            
                const relatedRecipient0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setRecipient)
                {
                    await
                    EmailNotification0.
                    setRecipient(relatedRecipient0);
                }
            
                const relatedRecipient1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setRecipient)
                {
                    await
                    EmailNotification1.
                    setRecipient(relatedRecipient1);
                }
            
                const relatedRecipient2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setRecipient)
                {
                    await
                    EmailNotification2.
                    setRecipient(relatedRecipient2);
                }
            
                const relatedRecipient3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EmailNotification3 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EmailNotification3?.setRecipient)
                {
                    await
                    EmailNotification3.
                    setRecipient(relatedRecipient3);
                }
            
        }
        
    
        
            
            async function associateEmailNotificationWithTemplate() {
            
                const relatedTemplate0 = await EmailTemplates.findOne({
                    offset: Math.floor(Math.random() * (await EmailTemplates.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setTemplate)
                {
                    await
                    EmailNotification0.
                    setTemplate(relatedTemplate0);
                }
            
                const relatedTemplate1 = await EmailTemplates.findOne({
                    offset: Math.floor(Math.random() * (await EmailTemplates.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setTemplate)
                {
                    await
                    EmailNotification1.
                    setTemplate(relatedTemplate1);
                }
            
                const relatedTemplate2 = await EmailTemplates.findOne({
                    offset: Math.floor(Math.random() * (await EmailTemplates.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setTemplate)
                {
                    await
                    EmailNotification2.
                    setTemplate(relatedTemplate2);
                }
            
                const relatedTemplate3 = await EmailTemplates.findOne({
                    offset: Math.floor(Math.random() * (await EmailTemplates.count())),
                });
                const EmailNotification3 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EmailNotification3?.setTemplate)
                {
                    await
                    EmailNotification3.
                    setTemplate(relatedTemplate3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEmailNotificationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification0 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EmailNotification0?.setOrganization)
                {
                    await
                    EmailNotification0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification1 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EmailNotification1?.setOrganization)
                {
                    await
                    EmailNotification1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification2 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EmailNotification2?.setOrganization)
                {
                    await
                    EmailNotification2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EmailNotification3 = await EmailNotifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EmailNotification3?.setOrganization)
                {
                    await
                    EmailNotification3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateImportWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Import0 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Import0?.setTenant)
                {
                    await
                    Import0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Import1 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Import1?.setTenant)
                {
                    await
                    Import1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Import2 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Import2?.setTenant)
                {
                    await
                    Import2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Import3 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Import3?.setTenant)
                {
                    await
                    Import3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateImportWithInitiated_by_user() {
            
                const relatedInitiated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Import0 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Import0?.setInitiated_by_user)
                {
                    await
                    Import0.
                    setInitiated_by_user(relatedInitiated_by_user0);
                }
            
                const relatedInitiated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Import1 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Import1?.setInitiated_by_user)
                {
                    await
                    Import1.
                    setInitiated_by_user(relatedInitiated_by_user1);
                }
            
                const relatedInitiated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Import2 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Import2?.setInitiated_by_user)
                {
                    await
                    Import2.
                    setInitiated_by_user(relatedInitiated_by_user2);
                }
            
                const relatedInitiated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Import3 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Import3?.setInitiated_by_user)
                {
                    await
                    Import3.
                    setInitiated_by_user(relatedInitiated_by_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateImportWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Import0 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Import0?.setOrganization)
                {
                    await
                    Import0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Import1 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Import1?.setOrganization)
                {
                    await
                    Import1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Import2 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Import2?.setOrganization)
                {
                    await
                    Import2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Import3 = await Imports.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Import3?.setOrganization)
                {
                    await
                    Import3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateExportWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Export0 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Export0?.setTenant)
                {
                    await
                    Export0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Export1 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Export1?.setTenant)
                {
                    await
                    Export1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Export2 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Export2?.setTenant)
                {
                    await
                    Export2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Export3 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Export3?.setTenant)
                {
                    await
                    Export3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateExportWithInitiated_by_user() {
            
                const relatedInitiated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Export0 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Export0?.setInitiated_by_user)
                {
                    await
                    Export0.
                    setInitiated_by_user(relatedInitiated_by_user0);
                }
            
                const relatedInitiated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Export1 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Export1?.setInitiated_by_user)
                {
                    await
                    Export1.
                    setInitiated_by_user(relatedInitiated_by_user1);
                }
            
                const relatedInitiated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Export2 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Export2?.setInitiated_by_user)
                {
                    await
                    Export2.
                    setInitiated_by_user(relatedInitiated_by_user2);
                }
            
                const relatedInitiated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Export3 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Export3?.setInitiated_by_user)
                {
                    await
                    Export3.
                    setInitiated_by_user(relatedInitiated_by_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateExportWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Export0 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Export0?.setOrganization)
                {
                    await
                    Export0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Export1 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Export1?.setOrganization)
                {
                    await
                    Export1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Export2 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Export2?.setOrganization)
                {
                    await
                    Export2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Export3 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Export3?.setOrganization)
                {
                    await
                    Export3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateApiClientWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiClient0 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApiClient0?.setTenant)
                {
                    await
                    ApiClient0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiClient1 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApiClient1?.setTenant)
                {
                    await
                    ApiClient1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiClient2 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApiClient2?.setTenant)
                {
                    await
                    ApiClient2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiClient3 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApiClient3?.setTenant)
                {
                    await
                    ApiClient3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateApiClientWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiClient0 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApiClient0?.setOrganization)
                {
                    await
                    ApiClient0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiClient1 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApiClient1?.setOrganization)
                {
                    await
                    ApiClient1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiClient2 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApiClient2?.setOrganization)
                {
                    await
                    ApiClient2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiClient3 = await ApiClients.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApiClient3?.setOrganization)
                {
                    await
                    ApiClient3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateApiTokenWithApi_client() {
            
                const relatedApi_client0 = await ApiClients.findOne({
                    offset: Math.floor(Math.random() * (await ApiClients.count())),
                });
                const ApiToken0 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApiToken0?.setApi_client)
                {
                    await
                    ApiToken0.
                    setApi_client(relatedApi_client0);
                }
            
                const relatedApi_client1 = await ApiClients.findOne({
                    offset: Math.floor(Math.random() * (await ApiClients.count())),
                });
                const ApiToken1 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApiToken1?.setApi_client)
                {
                    await
                    ApiToken1.
                    setApi_client(relatedApi_client1);
                }
            
                const relatedApi_client2 = await ApiClients.findOne({
                    offset: Math.floor(Math.random() * (await ApiClients.count())),
                });
                const ApiToken2 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApiToken2?.setApi_client)
                {
                    await
                    ApiToken2.
                    setApi_client(relatedApi_client2);
                }
            
                const relatedApi_client3 = await ApiClients.findOne({
                    offset: Math.floor(Math.random() * (await ApiClients.count())),
                });
                const ApiToken3 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApiToken3?.setApi_client)
                {
                    await
                    ApiToken3.
                    setApi_client(relatedApi_client3);
                }
            
        }
        
    
        
            
            async function associateApiTokenWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiToken0 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApiToken0?.setTenant)
                {
                    await
                    ApiToken0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiToken1 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApiToken1?.setTenant)
                {
                    await
                    ApiToken1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiToken2 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApiToken2?.setTenant)
                {
                    await
                    ApiToken2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ApiToken3 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApiToken3?.setTenant)
                {
                    await
                    ApiToken3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateApiTokenWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiToken0 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApiToken0?.setOrganization)
                {
                    await
                    ApiToken0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiToken1 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApiToken1?.setOrganization)
                {
                    await
                    ApiToken1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiToken2 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApiToken2?.setOrganization)
                {
                    await
                    ApiToken2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApiToken3 = await ApiTokens.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApiToken3?.setOrganization)
                {
                    await
                    ApiToken3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWebhookWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook0 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Webhook0?.setTenant)
                {
                    await
                    Webhook0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook1 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Webhook1?.setTenant)
                {
                    await
                    Webhook1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook2 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Webhook2?.setTenant)
                {
                    await
                    Webhook2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Webhook3 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Webhook3?.setTenant)
                {
                    await
                    Webhook3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWebhookWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook0 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Webhook0?.setOrganization)
                {
                    await
                    Webhook0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook1 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Webhook1?.setOrganization)
                {
                    await
                    Webhook1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook2 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Webhook2?.setOrganization)
                {
                    await
                    Webhook2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Webhook3 = await Webhooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Webhook3?.setOrganization)
                {
                    await
                    Webhook3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWebhookDeliveryWithWebhook() {
            
                const relatedWebhook0 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setWebhook)
                {
                    await
                    WebhookDelivery0.
                    setWebhook(relatedWebhook0);
                }
            
                const relatedWebhook1 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setWebhook)
                {
                    await
                    WebhookDelivery1.
                    setWebhook(relatedWebhook1);
                }
            
                const relatedWebhook2 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setWebhook)
                {
                    await
                    WebhookDelivery2.
                    setWebhook(relatedWebhook2);
                }
            
                const relatedWebhook3 = await Webhooks.findOne({
                    offset: Math.floor(Math.random() * (await Webhooks.count())),
                });
                const WebhookDelivery3 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WebhookDelivery3?.setWebhook)
                {
                    await
                    WebhookDelivery3.
                    setWebhook(relatedWebhook3);
                }
            
        }
        
    
        
            
            async function associateWebhookDeliveryWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setTenant)
                {
                    await
                    WebhookDelivery0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setTenant)
                {
                    await
                    WebhookDelivery1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setTenant)
                {
                    await
                    WebhookDelivery2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const WebhookDelivery3 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WebhookDelivery3?.setTenant)
                {
                    await
                    WebhookDelivery3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWebhookDeliveryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setOrganization)
                {
                    await
                    WebhookDelivery0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setOrganization)
                {
                    await
                    WebhookDelivery1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setOrganization)
                {
                    await
                    WebhookDelivery2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery3 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WebhookDelivery3?.setOrganization)
                {
                    await
                    WebhookDelivery3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateIntegrationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Integration0 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Integration0?.setTenant)
                {
                    await
                    Integration0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Integration1 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Integration1?.setTenant)
                {
                    await
                    Integration1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Integration2 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Integration2?.setTenant)
                {
                    await
                    Integration2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Integration3 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Integration3?.setTenant)
                {
                    await
                    Integration3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateIntegrationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration0 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Integration0?.setOrganization)
                {
                    await
                    Integration0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration1 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Integration1?.setOrganization)
                {
                    await
                    Integration1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration2 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Integration2?.setOrganization)
                {
                    await
                    Integration2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration3 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Integration3?.setOrganization)
                {
                    await
                    Integration3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCalendarAccountWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarAccount0 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarAccount0?.setTenant)
                {
                    await
                    CalendarAccount0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarAccount1 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarAccount1?.setTenant)
                {
                    await
                    CalendarAccount1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarAccount2 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarAccount2?.setTenant)
                {
                    await
                    CalendarAccount2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarAccount3 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarAccount3?.setTenant)
                {
                    await
                    CalendarAccount3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateCalendarAccountWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CalendarAccount0 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarAccount0?.setUser)
                {
                    await
                    CalendarAccount0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CalendarAccount1 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarAccount1?.setUser)
                {
                    await
                    CalendarAccount1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CalendarAccount2 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarAccount2?.setUser)
                {
                    await
                    CalendarAccount2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CalendarAccount3 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarAccount3?.setUser)
                {
                    await
                    CalendarAccount3.
                    setUser(relatedUser3);
                }
            
        }
        
    
        
            
            async function associateCalendarAccountWithIntegration() {
            
                const relatedIntegration0 = await Integrations.findOne({
                    offset: Math.floor(Math.random() * (await Integrations.count())),
                });
                const CalendarAccount0 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarAccount0?.setIntegration)
                {
                    await
                    CalendarAccount0.
                    setIntegration(relatedIntegration0);
                }
            
                const relatedIntegration1 = await Integrations.findOne({
                    offset: Math.floor(Math.random() * (await Integrations.count())),
                });
                const CalendarAccount1 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarAccount1?.setIntegration)
                {
                    await
                    CalendarAccount1.
                    setIntegration(relatedIntegration1);
                }
            
                const relatedIntegration2 = await Integrations.findOne({
                    offset: Math.floor(Math.random() * (await Integrations.count())),
                });
                const CalendarAccount2 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarAccount2?.setIntegration)
                {
                    await
                    CalendarAccount2.
                    setIntegration(relatedIntegration2);
                }
            
                const relatedIntegration3 = await Integrations.findOne({
                    offset: Math.floor(Math.random() * (await Integrations.count())),
                });
                const CalendarAccount3 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarAccount3?.setIntegration)
                {
                    await
                    CalendarAccount3.
                    setIntegration(relatedIntegration3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCalendarAccountWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarAccount0 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarAccount0?.setOrganization)
                {
                    await
                    CalendarAccount0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarAccount1 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarAccount1?.setOrganization)
                {
                    await
                    CalendarAccount1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarAccount2 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarAccount2?.setOrganization)
                {
                    await
                    CalendarAccount2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarAccount3 = await CalendarAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarAccount3?.setOrganization)
                {
                    await
                    CalendarAccount3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCalendarEventWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setTenant)
                {
                    await
                    CalendarEvent0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setTenant)
                {
                    await
                    CalendarEvent1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setTenant)
                {
                    await
                    CalendarEvent2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CalendarEvent3 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarEvent3?.setTenant)
                {
                    await
                    CalendarEvent3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateCalendarEventWithCalendar_account() {
            
                const relatedCalendar_account0 = await CalendarAccounts.findOne({
                    offset: Math.floor(Math.random() * (await CalendarAccounts.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setCalendar_account)
                {
                    await
                    CalendarEvent0.
                    setCalendar_account(relatedCalendar_account0);
                }
            
                const relatedCalendar_account1 = await CalendarAccounts.findOne({
                    offset: Math.floor(Math.random() * (await CalendarAccounts.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setCalendar_account)
                {
                    await
                    CalendarEvent1.
                    setCalendar_account(relatedCalendar_account1);
                }
            
                const relatedCalendar_account2 = await CalendarAccounts.findOne({
                    offset: Math.floor(Math.random() * (await CalendarAccounts.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setCalendar_account)
                {
                    await
                    CalendarEvent2.
                    setCalendar_account(relatedCalendar_account2);
                }
            
                const relatedCalendar_account3 = await CalendarAccounts.findOne({
                    offset: Math.floor(Math.random() * (await CalendarAccounts.count())),
                });
                const CalendarEvent3 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarEvent3?.setCalendar_account)
                {
                    await
                    CalendarEvent3.
                    setCalendar_account(relatedCalendar_account3);
                }
            
        }
        
    
        
            
            async function associateCalendarEventWithDeal() {
            
                const relatedDeal0 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setDeal)
                {
                    await
                    CalendarEvent0.
                    setDeal(relatedDeal0);
                }
            
                const relatedDeal1 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setDeal)
                {
                    await
                    CalendarEvent1.
                    setDeal(relatedDeal1);
                }
            
                const relatedDeal2 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setDeal)
                {
                    await
                    CalendarEvent2.
                    setDeal(relatedDeal2);
                }
            
                const relatedDeal3 = await Deals.findOne({
                    offset: Math.floor(Math.random() * (await Deals.count())),
                });
                const CalendarEvent3 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarEvent3?.setDeal)
                {
                    await
                    CalendarEvent3.
                    setDeal(relatedDeal3);
                }
            
        }
        
    
        
            
            async function associateCalendarEventWithContact() {
            
                const relatedContact0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setContact)
                {
                    await
                    CalendarEvent0.
                    setContact(relatedContact0);
                }
            
                const relatedContact1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setContact)
                {
                    await
                    CalendarEvent1.
                    setContact(relatedContact1);
                }
            
                const relatedContact2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setContact)
                {
                    await
                    CalendarEvent2.
                    setContact(relatedContact2);
                }
            
                const relatedContact3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const CalendarEvent3 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarEvent3?.setContact)
                {
                    await
                    CalendarEvent3.
                    setContact(relatedContact3);
                }
            
        }
        
    
        
            
            async function associateCalendarEventWithTask() {
            
                const relatedTask0 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setTask)
                {
                    await
                    CalendarEvent0.
                    setTask(relatedTask0);
                }
            
                const relatedTask1 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setTask)
                {
                    await
                    CalendarEvent1.
                    setTask(relatedTask1);
                }
            
                const relatedTask2 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setTask)
                {
                    await
                    CalendarEvent2.
                    setTask(relatedTask2);
                }
            
                const relatedTask3 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent3 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarEvent3?.setTask)
                {
                    await
                    CalendarEvent3.
                    setTask(relatedTask3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCalendarEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setOrganization)
                {
                    await
                    CalendarEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setOrganization)
                {
                    await
                    CalendarEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setOrganization)
                {
                    await
                    CalendarEvent2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent3 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CalendarEvent3?.setOrganization)
                {
                    await
                    CalendarEvent3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDashboardWidgetWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const DashboardWidget0 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DashboardWidget0?.setTenant)
                {
                    await
                    DashboardWidget0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const DashboardWidget1 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DashboardWidget1?.setTenant)
                {
                    await
                    DashboardWidget1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const DashboardWidget2 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DashboardWidget2?.setTenant)
                {
                    await
                    DashboardWidget2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const DashboardWidget3 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DashboardWidget3?.setTenant)
                {
                    await
                    DashboardWidget3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDashboardWidgetWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget0 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DashboardWidget0?.setOrganization)
                {
                    await
                    DashboardWidget0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget1 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DashboardWidget1?.setOrganization)
                {
                    await
                    DashboardWidget1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget2 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DashboardWidget2?.setOrganization)
                {
                    await
                    DashboardWidget2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DashboardWidget3 = await DashboardWidgets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DashboardWidget3?.setOrganization)
                {
                    await
                    DashboardWidget3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Tenants.bulkCreate(TenantsData);
                
            
            
                
                await RolePermissions.bulkCreate(RolePermissionsData);
                
            
            
                
                await Pipelines.bulkCreate(PipelinesData);
                
            
            
                
                await DealStages.bulkCreate(DealStagesData);
                
            
            
                
                await Companies.bulkCreate(CompaniesData);
                
            
            
                
                await Contacts.bulkCreate(ContactsData);
                
            
            
                
                await Leads.bulkCreate(LeadsData);
                
            
            
                
                await Deals.bulkCreate(DealsData);
                
            
            
                
                await Activities.bulkCreate(ActivitiesData);
                
            
            
                
                await Tasks.bulkCreate(TasksData);
                
            
            
                
                await Reminders.bulkCreate(RemindersData);
                
            
            
                
                await EmailTemplates.bulkCreate(EmailTemplatesData);
                
            
            
                
                await EmailNotifications.bulkCreate(EmailNotificationsData);
                
            
            
                
                await Imports.bulkCreate(ImportsData);
                
            
            
                
                await Exports.bulkCreate(ExportsData);
                
            
            
                
                await ApiClients.bulkCreate(ApiClientsData);
                
            
            
                
                await ApiTokens.bulkCreate(ApiTokensData);
                
            
            
                
                await Webhooks.bulkCreate(WebhooksData);
                
            
            
                
                await WebhookDeliveries.bulkCreate(WebhookDeliveriesData);
                
            
            
                
                await Integrations.bulkCreate(IntegrationsData);
                
            
            
                
                await CalendarAccounts.bulkCreate(CalendarAccountsData);
                
            
            
                
                await CalendarEvents.bulkCreate(CalendarEventsData);
                
            
            
                
                await DashboardWidgets.bulkCreate(DashboardWidgetsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTenantWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateRolePermissionWithPermission(),
                    
                
                    
                        
                        await associateRolePermissionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePipelineWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePipelineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDealStageWithPipeline(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDealStageWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCompanyWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanyWithOwner(),
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanyWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateContactWithTenant(),
                    
                
                    
                        
                        await associateContactWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateContactWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateContactWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateLeadWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLeadWithOwner(),
                    
                
                    
                
                    
                        
                        await associateLeadWithConverted_contact(),
                    
                
                    
                        
                        await associateLeadWithConverted_company(),
                    
                
                    
                        
                        await associateLeadWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDealWithTenant(),
                    
                
                    
                        
                        await associateDealWithCompany(),
                    
                
                    
                        
                        await associateDealWithPrimary_contact(),
                    
                
                    
                        
                        await associateDealWithPipeline(),
                    
                
                    
                        
                        await associateDealWithStage(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDealWithOwner(),
                    
                
                    
                
                    
                
                    
                        
                        await associateDealWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateActivityWithTenant(),
                    
                
                    
                        
                        await associateActivityWithActor(),
                    
                
                    
                
                    
                        
                        await associateActivityWithLead(),
                    
                
                    
                        
                        await associateActivityWithContact(),
                    
                
                    
                        
                        await associateActivityWithCompany(),
                    
                
                    
                        
                        await associateActivityWithDeal(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateActivityWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTaskWithTenant(),
                    
                
                    
                        
                        await associateTaskWithAssignee(),
                    
                
                    
                        
                        await associateTaskWithCreated_by_user(),
                    
                
                    
                        
                        await associateTaskWithLead(),
                    
                
                    
                        
                        await associateTaskWithContact(),
                    
                
                    
                        
                        await associateTaskWithCompany(),
                    
                
                    
                        
                        await associateTaskWithDeal(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReminderWithTenant(),
                    
                
                    
                        
                        await associateReminderWithUser(),
                    
                
                    
                        
                        await associateReminderWithTask(),
                    
                
                    
                        
                        await associateReminderWithDeal(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReminderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEmailTemplateWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEmailTemplateWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEmailNotificationWithTenant(),
                    
                
                    
                        
                        await associateEmailNotificationWithRecipient(),
                    
                
                    
                        
                        await associateEmailNotificationWithTemplate(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEmailNotificationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateImportWithTenant(),
                    
                
                    
                        
                        await associateImportWithInitiated_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateImportWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateExportWithTenant(),
                    
                
                    
                        
                        await associateExportWithInitiated_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateExportWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateApiClientWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateApiClientWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateApiTokenWithApi_client(),
                    
                
                    
                        
                        await associateApiTokenWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateApiTokenWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWebhookWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWebhookWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWebhookDeliveryWithWebhook(),
                    
                
                    
                        
                        await associateWebhookDeliveryWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWebhookDeliveryWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateIntegrationWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateIntegrationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCalendarAccountWithTenant(),
                    
                
                    
                        
                        await associateCalendarAccountWithUser(),
                    
                
                    
                        
                        await associateCalendarAccountWithIntegration(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCalendarAccountWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCalendarEventWithTenant(),
                    
                
                    
                        
                        await associateCalendarEventWithCalendar_account(),
                    
                
                    
                        
                        await associateCalendarEventWithDeal(),
                    
                
                    
                        
                        await associateCalendarEventWithContact(),
                    
                
                    
                        
                        await associateCalendarEventWithTask(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCalendarEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDashboardWidgetWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDashboardWidgetWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('tenants', null, {});
            
            
            await queryInterface.bulkDelete('role_permissions', null, {});
            
            
            await queryInterface.bulkDelete('pipelines', null, {});
            
            
            await queryInterface.bulkDelete('deal_stages', null, {});
            
            
            await queryInterface.bulkDelete('companies', null, {});
            
            
            await queryInterface.bulkDelete('contacts', null, {});
            
            
            await queryInterface.bulkDelete('leads', null, {});
            
            
            await queryInterface.bulkDelete('deals', null, {});
            
            
            await queryInterface.bulkDelete('activities', null, {});
            
            
            await queryInterface.bulkDelete('tasks', null, {});
            
            
            await queryInterface.bulkDelete('reminders', null, {});
            
            
            await queryInterface.bulkDelete('email_templates', null, {});
            
            
            await queryInterface.bulkDelete('email_notifications', null, {});
            
            
            await queryInterface.bulkDelete('imports', null, {});
            
            
            await queryInterface.bulkDelete('exports', null, {});
            
            
            await queryInterface.bulkDelete('api_clients', null, {});
            
            
            await queryInterface.bulkDelete('api_tokens', null, {});
            
            
            await queryInterface.bulkDelete('webhooks', null, {});
            
            
            await queryInterface.bulkDelete('webhook_deliveries', null, {});
            
            
            await queryInterface.bulkDelete('integrations', null, {});
            
            
            await queryInterface.bulkDelete('calendar_accounts', null, {});
            
            
            await queryInterface.bulkDelete('calendar_events', null, {});
            
            
            await queryInterface.bulkDelete('dashboard_widgets', null, {});
            
        
    },
};