





















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






const Companies = db.companies;

const BusinessUnits = db.business_units;

const Tags = db.tags;

const Assets = db.assets;

const Tenants = db.tenants;

const Leases = db.leases;

const WorkOrders = db.work_orders;

const Products = db.products;

const Warehouses = db.warehouses;

const InventoryItems = db.inventory_items;

const InventoryTransactions = db.inventory_transactions;

const Customers = db.customers;

const SalesOrders = db.sales_orders;

const SalesOrderLines = db.sales_order_lines;

const Invoices = db.invoices;

const Payments = db.payments;

const CrmPipelines = db.crm_pipelines;

const CrmStages = db.crm_stages;

const Leads = db.leads;

const Activities = db.activities;

const ContentFolders = db.content_folders;

const ContentItems = db.content_items;

const SeoKeywords = db.seo_keywords;

const ContentCampaigns = db.content_campaigns;

const Dashboards = db.dashboards;

const Reports = db.reports;







const CompaniesData = [
    
    {
    
        
        
            
                "name": "Nusantara Holdings",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Meranti Property",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Kirana Retail",
            
        
    
    },
    
];



const BusinessUnitsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Property Division",
            
        
    
        
        
            
                "description": "Manages assets, leases, and maintenance operations.",
            
        
    
        
        
            
                "unit_type": "property",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Retail Division",
            
        
    
        
        
            
                "description": "Manages products, inventory, sales orders, and fulfillment.",
            
        
    
        
        
            
                "unit_type": "general",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Content and Growth",
            
        
    
        
        
            
                "description": "Manages SEO, content production, and campaigns.",
            
        
    
        
        
            
                "unit_type": "general",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const TagsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Priority",
            
        
    
        
        
            
                "scope": "crm",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "VIP",
            
        
    
        
        
            
                "scope": "crm",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Maintenance",
            
        
    
        
        
            
                "scope": "inventory",
            
        
    
    },
    
];



const AssetsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Meranti Tower Unit 12A",
            
        
    
        
        
            
                "asset_type": "equipment",
            
        
    
        
        
            
                "status": "rented",
            
        
    
        
        
            
                "asset_code": "AST-MP-UNIT-12A",
            
        
    
        
        
            
                "address": "Meranti Tower, Jl. Gatot Subroto No. 88, Jakarta",
            
        
    
        
        
            
                "purchase_price": 1450000000,
            
        
    
        
        
            
                "purchase_date": new Date('2022-04-15T00:00:00Z'),
            
        
    
        
        
            
                "current_valuation": 1600000000,
            
        
    
        
        
            
                "valuation_date": new Date('2025-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Meranti Tower Unit 07C",
            
        
    
        
        
            
                "asset_type": "land",
            
        
    
        
        
            
                "status": "rented",
            
        
    
        
        
            
                "asset_code": "AST-MP-UNIT-07C",
            
        
    
        
        
            
                "address": "Meranti Tower, Jl. Gatot Subroto No. 88, Jakarta",
            
        
    
        
        
            
                "purchase_price": 1200000000,
            
        
    
        
        
            
                "purchase_date": new Date('2021-10-10T00:00:00Z'),
            
        
    
        
        
            
                "current_valuation": 1350000000,
            
        
    
        
        
            
                "valuation_date": new Date('2025-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Gudang Cakung A",
            
        
    
        
        
            
                "asset_type": "land",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "asset_code": "AST-MP-WH-CAK-A",
            
        
    
        
        
            
                "address": "Kawasan Industri Cakung, Jakarta Timur",
            
        
    
        
        
            
                "purchase_price": 3200000000,
            
        
    
        
        
            
                "purchase_date": new Date('2020-02-20T00:00:00Z'),
            
        
    
        
        
            
                "current_valuation": 3500000000,
            
        
    
        
        
            
                "valuation_date": new Date('2025-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const TenantsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PT Sinar Abadi",
            
        
    
        
        
            
                "tenant_type": "company",
            
        
    
        
        
            
                "email": "finance@sinarabadi.co.id",
            
        
    
        
        
            
                "phone": "+62 21 700 1234",
            
        
    
        
        
            
                "billing_address": "Jl. Kebon Sirih No. 21, Jakarta",
            
        
    
        
        
            
                "notes": "Prefers monthly invoicing and e-invoice PDF.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Dewi Anggraini",
            
        
    
        
        
            
                "tenant_type": "company",
            
        
    
        
        
            
                "email": "dewi.anggraini@email.com",
            
        
    
        
        
            
                "phone": "+62 812 9000 222",
            
        
    
        
        
            
                "billing_address": "Jl. Cipete Raya, Jakarta Selatan",
            
        
    
        
        
            
                "notes": "Works remotely, requests quiet unit.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "CV Karya Mandiri",
            
        
    
        
        
            
                "tenant_type": "individual",
            
        
    
        
        
            
                "email": "admin@karyamandiri.id",
            
        
    
        
        
            
                "phone": "+62 22 800 4567",
            
        
    
        
        
            
                "billing_address": "Jl. Pasteur No. 12, Bandung",
            
        
    
        
        
            
                "notes": "Needs parking access for staff.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const LeasesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lease_number": "LSE-2026-0001",
            
        
    
        
        
            
                "status": "terminated",
            
        
    
        
        
            
                "start_date": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "rent_amount": 25000000,
            
        
    
        
        
            
                "billing_cycle": "yearly",
            
        
    
        
        
            
                "deposit_amount": 50000000,
            
        
    
        
        
            
                "signed_at": new Date('2025-12-20T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Annual lease with quarterly review.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lease_number": "LSE-2026-0002",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "start_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2027-02-28T00:00:00Z'),
            
        
    
        
        
            
                "rent_amount": 18000000,
            
        
    
        
        
            
                "billing_cycle": "daily",
            
        
    
        
        
            
                "deposit_amount": 36000000,
            
        
    
        
        
            
                "signed_at": new Date('2026-02-15T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Includes signage rights on facade.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lease_number": "LSE-2026-0003",
            
        
    
        
        
            
                "status": "terminated",
            
        
    
        
        
            
                "start_date": new Date('2026-07-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2027-06-30T00:00:00Z'),
            
        
    
        
        
            
                "rent_amount": 16000000,
            
        
    
        
        
            
                "billing_cycle": "quarterly",
            
        
    
        
        
            
                "deposit_amount": 32000000,
            
        
    
        
        
            
                "signed_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Pending final ID verification.",
            
        
    
    },
    
];



const WorkOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Repair loading dock shutter",
            
        
    
        
        
            
                "description": "Shutter motor intermittently stops. Inspect wiring and replace capacitor if needed.",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "reported_at": new Date('2026-06-10T02:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-24T02:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-18T08:00:00Z'),
            
        
    
        
        
            
                "estimated_cost": 3500000,
            
        
    
        
        
            
                "actual_cost": 3200000,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "title": "Air conditioner maintenance",
            
        
    
        
        
            
                "description": "Routine cleaning and refrigerant check for living room AC unit.",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "reported_at": new Date('2026-06-01T03:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-07T03:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-06T09:30:00Z'),
            
        
    
        
        
            
                "estimated_cost": 750000,
            
        
    
        
        
            
                "actual_cost": 700000,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "title": "Repaint interior walls",
            
        
    
        
        
            
                "description": "Touch-up repaint, neutral white, fix minor cracks near window.",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "reported_at": new Date('2026-06-15T05:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-30T05:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-20T05:00:00Z'),
            
        
    
        
        
            
                "estimated_cost": 2500000,
            
        
    
        
        
            
                "actual_cost": 0,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ProductsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Kopi Arabica 250g",
            
        
    
        
        
            
                "sku": "KR-CFE-AR250",
            
        
    
        
        
            
                "barcode": "8991234500012",
            
        
    
        
        
            
                "product_type": "digital",
            
        
    
        
        
            
                "description": "Single origin Arabica, medium roast, 250 grams.",
            
        
    
        
        
            
                "cost_price": 45000,
            
        
    
        
        
            
                "sale_price": 75000,
            
        
    
        
        
            
                "reorder_point": 30,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Teh Hijau 100g",
            
        
    
        
        
            
                "sku": "KR-TEA-GR100",
            
        
    
        
        
            
                "barcode": "8991234500029",
            
        
    
        
        
            
                "product_type": "physical",
            
        
    
        
        
            
                "description": "Loose leaf green tea, 100 grams.",
            
        
    
        
        
            
                "cost_price": 20000,
            
        
    
        
        
            
                "sale_price": 40000,
            
        
    
        
        
            
                "reorder_point": 50,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Botol Minum Stainless 600ml",
            
        
    
        
        
            
                "sku": "KR-BTL-SS600",
            
        
    
        
        
            
                "barcode": "8991234500036",
            
        
    
        
        
            
                "product_type": "service",
            
        
    
        
        
            
                "description": "Insulated stainless bottle, 600ml.",
            
        
    
        
        
            
                "cost_price": 85000,
            
        
    
        
        
            
                "sale_price": 139000,
            
        
    
        
        
            
                "reorder_point": 20,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Bandung Main Warehouse",
            
        
    
        
        
            
                "code": "BDG-MAIN",
            
        
    
        
        
            
                "address": "Jl. Soekarno Hatta No. 120, Bandung",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Jakarta Fulfillment Hub",
            
        
    
        
        
            
                "code": "JKT-HUB",
            
        
    
        
        
            
                "address": "Jl. Raya Bekasi Km 21, Jakarta Timur",
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Surabaya Crossdock",
            
        
    
        
        
            
                "code": "SBY-XD",
            
        
    
        
        
            
                "address": "Jl. Ahmad Yani No. 5, Surabaya",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const InventoryItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 240,
            
        
    
        
        
            
                "quantity_reserved": 18,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-15T02:00:00Z'),
            
        
    
        
        
            
                "average_cost": 46000,
            
        
    
        
        
            
                "bin_location": "A-01-01",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 520,
            
        
    
        
        
            
                "quantity_reserved": 35,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-15T02:05:00Z'),
            
        
    
        
        
            
                "average_cost": 20500,
            
        
    
        
        
            
                "bin_location": "A-01-02",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 90,
            
        
    
        
        
            
                "quantity_reserved": 12,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-14T09:00:00Z'),
            
        
    
        
        
            
                "average_cost": 86000,
            
        
    
        
        
            
                "bin_location": "B-02-03",
            
        
    
    },
    
];



const InventoryTransactionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "transfer",
            
        
    
        
        
            
                "quantity": 200,
            
        
    
        
        
            
                "unit_cost": 45000,
            
        
    
        
        
            
                "reference": "PO-2026-0610",
            
        
    
        
        
            
                "transaction_at": new Date('2026-06-10T01:00:00Z'),
            
        
    
        
        
            
                "notes": "Received from supplier PT Kopi Nusantara.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "adjustment",
            
        
    
        
        
            
                "quantity": 40,
            
        
    
        
        
            
                "unit_cost": 46000,
            
        
    
        
        
            
                "reference": "SO-2026-1001",
            
        
    
        
        
            
                "transaction_at": new Date('2026-06-16T06:30:00Z'),
            
        
    
        
        
            
                "notes": "Shipped for sales order fulfillment.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "transfer",
            
        
    
        
        
            
                "quantity": -5,
            
        
    
        
        
            
                "unit_cost": 20500,
            
        
    
        
        
            
                "reference": "ADJ-2026-0615",
            
        
    
        
        
            
                "transaction_at": new Date('2026-06-15T02:10:00Z'),
            
        
    
        
        
            
                "notes": "Cycle count discrepancy adjustment.",
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PT Bintang Kuliner",
            
        
    
        
        
            
                "customer_type": "company",
            
        
    
        
        
            
                "email": "purchasing@bintangkuliner.co.id",
            
        
    
        
        
            
                "phone": "+62 21 600 7788",
            
        
    
        
        
            
                "address": "Jl. Kuningan Barat No. 3, Jakarta",
            
        
    
        
        
            
                "city": "Jakarta",
            
        
    
        
        
            
                "country": "Indonesia",
            
        
    
        
        
            
                "notes": "Buys coffee for office pantry. Prefers monthly billing.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Siti Rahmawati",
            
        
    
        
        
            
                "customer_type": "company",
            
        
    
        
        
            
                "email": "siti.rahmawati@email.com",
            
        
    
        
        
            
                "phone": "+62 812 3100 889",
            
        
    
        
        
            
                "address": "Jl. Dago No. 9, Bandung",
            
        
    
        
        
            
                "city": "Bandung",
            
        
    
        
        
            
                "country": "Indonesia",
            
        
    
        
        
            
                "notes": "Repeat customer for granola and tea.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Andreas Wijaya",
            
        
    
        
        
            
                "customer_type": "company",
            
        
    
        
        
            
                "email": "andreas.wijaya@email.com",
            
        
    
        
        
            
                "phone": "+62 813 7700 120",
            
        
    
        
        
            
                "address": "Jl. Kelapa Gading, Jakarta",
            
        
    
        
        
            
                "city": "Jakarta",
            
        
    
        
        
            
                "country": "Indonesia",
            
        
    
        
        
            
                "notes": "Prefers delivery in the afternoon.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const SalesOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "SO-2026-1001",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "order_date": new Date('2026-06-16T06:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-16T06:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 273000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "shipping_amount": 15000,
            
        
    
        
        
            
                "total_amount": 288000,
            
        
    
        
        
            
                "payment_status": "partial",
            
        
    
        
        
            
                "notes": "Delivered same day via courier.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "SO-2026-1002",
            
        
    
        
        
            
                "status": "refunded",
            
        
    
        
        
            
                "order_date": new Date('2026-06-18T02:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-19T02:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 214000,
            
        
    
        
        
            
                "discount_amount": 10000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "shipping_amount": 20000,
            
        
    
        
        
            
                "total_amount": 224000,
            
        
    
        
        
            
                "payment_status": "paid",
            
        
    
        
        
            
                "notes": "Customer requested afternoon delivery.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "SO-2026-1003",
            
        
    
        
        
            
                "status": "confirmed",
            
        
    
        
        
            
                "order_date": new Date('2026-06-19T03:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-26T03:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 1500000,
            
        
    
        
        
            
                "discount_amount": 50000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "shipping_amount": 0,
            
        
    
        
        
            
                "total_amount": 1450000,
            
        
    
        
        
            
                "payment_status": "partial",
            
        
    
        
        
            
                "notes": "Invoice required for accounting.",
            
        
    
    },
    
];



const SalesOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Kopi Arabica 250g",
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                "unit_price": 75000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "line_total": 150000,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Granola Mix 500g",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 99000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "line_total": 99000,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Botol Minum Stainless 600ml",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 139000,
            
        
    
        
        
            
                "discount_amount": 10000,
            
        
    
        
        
            
                "line_total": 129000,
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-3001",
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "issue_date": new Date('2026-06-16T06:10:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-16T06:10:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 273000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 288000,
            
        
    
        
        
            
                "amount_paid": 288000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-16T06:20:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Paid via e-wallet.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-3002",
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "issue_date": new Date('2026-06-18T02:10:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-19T02:10:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 214000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 224000,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-20T02:10:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Awaiting payment before dispatch.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-3003",
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "issue_date": new Date('2026-06-19T03:10:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-26T03:10:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 1500000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 1450000,
            
        
    
        
        
            
                "amount_paid": 500000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-20T03:10:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Partial payment received, balance due next week.",
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-2026-5001",
            
        
    
        
        
            
                "method": "ewallet",
            
        
    
        
        
            
                "amount": 288000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-16T06:20:00Z'),
            
        
    
        
        
            
                "notes": "Settled in full.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "payment_reference": "PAY-2026-5002",
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "amount": 500000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-20T03:00:00Z'),
            
        
    
        
        
            
                "notes": "Partial settlement, remaining balance open.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "payment_reference": "PAY-2026-5003",
            
        
    
        
        
            
                "method": "other",
            
        
    
        
        
            
                "amount": 224000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-19T01:00:00Z'),
            
        
    
        
        
            
                "notes": "Paid before dispatch.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const CrmPipelinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "B2B Sales Pipeline",
            
        
    
        
        
            
                "description": "Pipeline for corporate and partnership opportunities.",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Property Leasing Pipeline",
            
        
    
        
        
            
                "description": "Pipeline for prospective tenants and lease negotiation.",
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Wholesale Accounts",
            
        
    
        
        
            
                "description": "Pipeline for wholesale leads and repeat orders.",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const CrmStagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "New",
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "is_won": false,
            
        
    
        
        
            
                "is_lost": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Qualified",
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
        
        
            
                "is_won": false,
            
        
    
        
        
            
                "is_lost": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Proposal Sent",
            
        
    
        
        
            
                "sort_order": 3,
            
        
    
        
        
            
                "is_won": false,
            
        
    
        
        
            
                "is_lost": false,
            
        
    
    },
    
];



const LeadsData = [
    
    {
    
        
        
            
                // 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": "Pantry supply for PT Bintang Kuliner",
            
        
    
        
        
            
                "contact_name": "Arif Hidayat",
            
        
    
        
        
            
                "email": "arif.hidayat@bintangkuliner.co.id",
            
        
    
        
        
            
                "phone": "+62 21 600 7788",
            
        
    
        
        
            
                "source": "Referral",
            
        
    
        
        
            
                "estimated_value": 15000000,
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "created_on": new Date('2026-06-12T01:00:00Z'),
            
        
    
        
        
            
                "next_follow_up_at": new Date('2026-06-24T03:00:00Z'),
            
        
    
        
        
            
                "notes": "Discuss monthly supply volume and billing terms.",
            
        
    
        
        
            
                // type code here for "relation_many" 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": "Inquiry for Meranti Tower Unit 07C",
            
        
    
        
        
            
                "contact_name": "Rizky Fajar",
            
        
    
        
        
            
                "email": "rizky.fajar@email.com",
            
        
    
        
        
            
                "phone": "+62 813 4000 555",
            
        
    
        
        
            
                "source": "Website",
            
        
    
        
        
            
                "estimated_value": 192000000,
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "lost",
            
        
    
        
        
            
                "created_on": new Date('2026-06-18T02:00:00Z'),
            
        
    
        
        
            
                "next_follow_up_at": new Date('2026-06-22T02:00:00Z'),
            
        
    
        
        
            
                "notes": "Schedule viewing and confirm move-in date.",
            
        
    
        
        
            
                // type code here for "relation_many" 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": "Brand refresh for PT Sentosa Digital",
            
        
    
        
        
            
                "contact_name": "Maya Pratiwi",
            
        
    
        
        
            
                "email": "marketing@sentosadigital.id",
            
        
    
        
        
            
                "phone": "+62 22 880 1122",
            
        
    
        
        
            
                "source": "Inbound",
            
        
    
        
        
            
                "estimated_value": 12000000,
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "created_on": new Date('2026-06-10T04:00:00Z'),
            
        
    
        
        
            
                "next_follow_up_at": new Date('2026-06-23T04:00:00Z'),
            
        
    
        
        
            
                "notes": "Awaiting feedback on proposal and timeline.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const ActivitiesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "activity_type": "note",
            
        
    
        
        
            
                "subject": "Follow-up on monthly volume",
            
        
    
        
        
            
                "details": "Confirm expected consumption and preferred payment terms.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-24T03:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-24T03:30:00Z'),
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                // 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": "email",
            
        
    
        
        
            
                "subject": "Unit viewing appointment",
            
        
    
        
        
            
                "details": "Meet at lobby, show Unit 07C and discuss lease terms.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-22T02:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-22T03:00:00Z'),
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                // 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",
            
        
    
        
        
            
                "subject": "Send updated proposal",
            
        
    
        
        
            
                "details": "Include revised timeline and deliverables list.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-23T04:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-23T04:10:00Z'),
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ContentFoldersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Content",
            
        
    
        
        
            
                "description": "Root folder for content items.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Promotions",
            
        
    
        
        
            
                "description": "Promo copy and seasonal offers.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "SEO Articles",
            
        
    
        
        
            
                "description": "Blog drafts and published articles.",
            
        
    
    },
    
];



const ContentItemsData = [
    
    {
    
        
        
            
                // 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": "June Coffee Bundle Promo",
            
        
    
        
        
            
                "content_type": "social_post",
            
        
    
        
        
            
                "status": "review",
            
        
    
        
        
            
                "body": "Buy 2 Kopi Arabica 250g and get free shipping for Bandung area.",
            
        
    
        
        
            
                "summary": "Bundle promo for coffee products.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-22T01:00:00Z'),
            
        
    
        
        
            
                "published_at": new Date('2026-06-22T01:05:00Z'),
            
        
    
        
        
            
                "channel": "Instagram",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" 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": "How to Choose Arabica Beans",
            
        
    
        
        
            
                "content_type": "other",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "body": "Outline the differences between arabica and robusta and what to look for in freshness.",
            
        
    
        
        
            
                "summary": "Educational blog draft on coffee beans.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-28T01:00:00Z'),
            
        
    
        
        
            
                "published_at": new Date('2026-06-28T01:05:00Z'),
            
        
    
        
        
            
                "channel": "Website",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" 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": "Branding refresh brief for Sentosa Digital",
            
        
    
        
        
            
                "content_type": "promo_copy",
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "body": "Need modern, clean brand system. Target audience: SMB founders. Deliverables: logo update, palette, typography, social templates.",
            
        
    
        
        
            
                "summary": "Design brief for a branding refresh project.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-24T02:00:00Z'),
            
        
    
        
        
            
                "published_at": new Date('2026-06-24T02:05:00Z'),
            
        
    
        
        
            
                "channel": "Internal",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const SeoKeywordsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "keyword": "kopi arabica terbaik",
            
        
    
        
        
            
                "intent": "navigational",
            
        
    
        
        
            
                "difficulty": "medium",
            
        
    
        
        
            
                "search_volume": 2400,
            
        
    
        
        
            
                "cpc": 1800,
            
        
    
        
        
            
                "target_url": "https://kiranaretail.id/kopi-arabica",
            
        
    
        
        
            
                "notes": "Target with product page and supporting blog.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "keyword": "cara memilih biji kopi",
            
        
    
        
        
            
                "intent": "commercial",
            
        
    
        
        
            
                "difficulty": "low",
            
        
    
        
        
            
                "search_volume": 1600,
            
        
    
        
        
            
                "cpc": 900,
            
        
    
        
        
            
                "target_url": "https://kiranaretail.id/blog/pilih-biji-kopi",
            
        
    
        
        
            
                "notes": "Use as pillar content for coffee education series.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "keyword": "granola sehat untuk sarapan",
            
        
    
        
        
            
                "intent": "informational",
            
        
    
        
        
            
                "difficulty": "low",
            
        
    
        
        
            
                "search_volume": 1300,
            
        
    
        
        
            
                "cpc": 1200,
            
        
    
        
        
            
                "target_url": "https://kiranaretail.id/granola",
            
        
    
        
        
            
                "notes": "Support with recipe content and social snippets.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const ContentCampaignsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Q3 Healthy Snacks Push",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_date": new Date('2026-07-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-09-30T00:00:00Z'),
            
        
    
        
        
            
                "budget": 15000000,
            
        
    
        
        
            
                "goal": "Increase granola sales and repeat customers through SEO and social content.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Coffee Education Series",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_date": new Date('2026-06-25T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-08-15T00:00:00Z'),
            
        
    
        
        
            
                "budget": 8000000,
            
        
    
        
        
            
                "goal": "Build top-of-funnel traffic for coffee category pages.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Bandung Local Delivery Promo",
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "start_date": new Date('2026-06-20T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "budget": 3000000,
            
        
    
        
        
            
                "goal": "Boost short-term conversions with free shipping bundle promo.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const DashboardsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Executive Overview",
            
        
    
        
        
            
                "visibility": "company",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "layout_json": "{widgets:[revenue,cash_in,occupancy,pipeline,inventory_alerts]}",
            
        
    
        
        
            
                "is_default": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Property Ops Dashboard",
            
        
    
        
        
            
                "visibility": "company",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "layout_json": "{widgets:[asset_status,leases_expiring,work_orders,tenant_notes]}",
            
        
    
        
        
            
                "is_default": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Retail Operations",
            
        
    
        
        
            
                "visibility": "company",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "layout_json": "{widgets:[sales_today,top_products,low_stock,fulfillment_status]}",
            
        
    
        
        
            
                "is_default": true,
            
        
    
    },
    
];



const ReportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "June Sales Summary",
            
        
    
        
        
            
                "report_type": "sales_summary",
            
        
    
        
        
            
                "period_start": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "filters_json": "{company:Kirana Retail,status:[confirmed,fulfilled]}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Asset Occupancy Q2",
            
        
    
        
        
            
                "report_type": "inventory_turnover",
            
        
    
        
        
            
                "period_start": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "filters_json": "{status:[rented,available]}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Inventory Turnover Q2",
            
        
    
        
        
            
                "report_type": "custom",
            
        
    
        
        
            
                "period_start": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "filters_json": "{warehouse:[Bandung Main Warehouse,Jakarta Fulfillment Hub]}",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setCompany)
                {
                    await
                    User0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setCompany)
                {
                    await
                    User1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setCompany)
                {
                    await
                    User2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateBusinessUnitWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BusinessUnit0 = await BusinessUnits.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BusinessUnit0?.setCompany)
                {
                    await
                    BusinessUnit0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BusinessUnit1 = await BusinessUnits.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BusinessUnit1?.setCompany)
                {
                    await
                    BusinessUnit1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BusinessUnit2 = await BusinessUnits.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BusinessUnit2?.setCompany)
                {
                    await
                    BusinessUnit2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTagWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Tag0 = await Tags.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Tag0?.setCompany)
                {
                    await
                    Tag0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Tag1 = await Tags.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Tag1?.setCompany)
                {
                    await
                    Tag1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Tag2 = await Tags.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Tag2?.setCompany)
                {
                    await
                    Tag2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateAssetWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Asset0 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Asset0?.setCompany)
                {
                    await
                    Asset0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Asset1 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Asset1?.setCompany)
                {
                    await
                    Asset1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Asset2 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Asset2?.setCompany)
                {
                    await
                    Asset2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateAssetWithBusiness_unit() {
            
                const relatedBusiness_unit0 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const Asset0 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Asset0?.setBusiness_unit)
                {
                    await
                    Asset0.
                    setBusiness_unit(relatedBusiness_unit0);
                }
            
                const relatedBusiness_unit1 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const Asset1 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Asset1?.setBusiness_unit)
                {
                    await
                    Asset1.
                    setBusiness_unit(relatedBusiness_unit1);
                }
            
                const relatedBusiness_unit2 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const Asset2 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Asset2?.setBusiness_unit)
                {
                    await
                    Asset2.
                    setBusiness_unit(relatedBusiness_unit2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateTenantWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Tenant0 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Tenant0?.setCompany)
                {
                    await
                    Tenant0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Tenant1 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Tenant1?.setCompany)
                {
                    await
                    Tenant1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Tenant2 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Tenant2?.setCompany)
                {
                    await
                    Tenant2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateLeasWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Leas0 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Leas0?.setCompany)
                {
                    await
                    Leas0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Leas1 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Leas1?.setCompany)
                {
                    await
                    Leas1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Leas2 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Leas2?.setCompany)
                {
                    await
                    Leas2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateLeasWithAsset() {
            
                const relatedAsset0 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const Leas0 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Leas0?.setAsset)
                {
                    await
                    Leas0.
                    setAsset(relatedAsset0);
                }
            
                const relatedAsset1 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const Leas1 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Leas1?.setAsset)
                {
                    await
                    Leas1.
                    setAsset(relatedAsset1);
                }
            
                const relatedAsset2 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const Leas2 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Leas2?.setAsset)
                {
                    await
                    Leas2.
                    setAsset(relatedAsset2);
                }
            
        }
        
    
        
            
            async function associateLeasWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Leas0 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Leas0?.setTenant)
                {
                    await
                    Leas0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Leas1 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Leas1?.setTenant)
                {
                    await
                    Leas1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Leas2 = await Leases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Leas2?.setTenant)
                {
                    await
                    Leas2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateWorkOrderWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setCompany)
                {
                    await
                    WorkOrder0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setCompany)
                {
                    await
                    WorkOrder1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setCompany)
                {
                    await
                    WorkOrder2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithAsset() {
            
                const relatedAsset0 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setAsset)
                {
                    await
                    WorkOrder0.
                    setAsset(relatedAsset0);
                }
            
                const relatedAsset1 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setAsset)
                {
                    await
                    WorkOrder1.
                    setAsset(relatedAsset1);
                }
            
                const relatedAsset2 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setAsset)
                {
                    await
                    WorkOrder2.
                    setAsset(relatedAsset2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithAssigned_to() {
            
                const relatedAssigned_to0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setAssigned_to)
                {
                    await
                    WorkOrder0.
                    setAssigned_to(relatedAssigned_to0);
                }
            
                const relatedAssigned_to1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setAssigned_to)
                {
                    await
                    WorkOrder1.
                    setAssigned_to(relatedAssigned_to1);
                }
            
                const relatedAssigned_to2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setAssigned_to)
                {
                    await
                    WorkOrder2.
                    setAssigned_to(relatedAssigned_to2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateProductWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setCompany)
                {
                    await
                    Product0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setCompany)
                {
                    await
                    Product1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setCompany)
                {
                    await
                    Product2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateProductWithBusiness_unit() {
            
                const relatedBusiness_unit0 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setBusiness_unit)
                {
                    await
                    Product0.
                    setBusiness_unit(relatedBusiness_unit0);
                }
            
                const relatedBusiness_unit1 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setBusiness_unit)
                {
                    await
                    Product1.
                    setBusiness_unit(relatedBusiness_unit1);
                }
            
                const relatedBusiness_unit2 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setBusiness_unit)
                {
                    await
                    Product2.
                    setBusiness_unit(relatedBusiness_unit2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateWarehousWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setCompany)
                {
                    await
                    Warehous0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setCompany)
                {
                    await
                    Warehous1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setCompany)
                {
                    await
                    Warehous2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryItemWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setCompany)
                {
                    await
                    InventoryItem0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setCompany)
                {
                    await
                    InventoryItem1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setCompany)
                {
                    await
                    InventoryItem2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setProduct)
                {
                    await
                    InventoryItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setProduct)
                {
                    await
                    InventoryItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setProduct)
                {
                    await
                    InventoryItem2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setWarehouse)
                {
                    await
                    InventoryItem0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setWarehouse)
                {
                    await
                    InventoryItem1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setWarehouse)
                {
                    await
                    InventoryItem2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryTransactionWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setCompany)
                {
                    await
                    InventoryTransaction0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setCompany)
                {
                    await
                    InventoryTransaction1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setCompany)
                {
                    await
                    InventoryTransaction2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setProduct)
                {
                    await
                    InventoryTransaction0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setProduct)
                {
                    await
                    InventoryTransaction1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setProduct)
                {
                    await
                    InventoryTransaction2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setWarehouse)
                {
                    await
                    InventoryTransaction0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setWarehouse)
                {
                    await
                    InventoryTransaction1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setWarehouse)
                {
                    await
                    InventoryTransaction2.
                    setWarehouse(relatedWarehouse2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCustomerWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setCompany)
                {
                    await
                    Customer0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setCompany)
                {
                    await
                    Customer1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setCompany)
                {
                    await
                    Customer2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateSalesOrderWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setCompany)
                {
                    await
                    SalesOrder0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setCompany)
                {
                    await
                    SalesOrder1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setCompany)
                {
                    await
                    SalesOrder2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderWithBusiness_unit() {
            
                const relatedBusiness_unit0 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setBusiness_unit)
                {
                    await
                    SalesOrder0.
                    setBusiness_unit(relatedBusiness_unit0);
                }
            
                const relatedBusiness_unit1 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setBusiness_unit)
                {
                    await
                    SalesOrder1.
                    setBusiness_unit(relatedBusiness_unit1);
                }
            
                const relatedBusiness_unit2 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setBusiness_unit)
                {
                    await
                    SalesOrder2.
                    setBusiness_unit(relatedBusiness_unit2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setCustomer)
                {
                    await
                    SalesOrder0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setCustomer)
                {
                    await
                    SalesOrder1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setCustomer)
                {
                    await
                    SalesOrder2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSalesOrderLineWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setCompany)
                {
                    await
                    SalesOrderLine0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setCompany)
                {
                    await
                    SalesOrderLine1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setCompany)
                {
                    await
                    SalesOrderLine2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderLineWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setSales_order)
                {
                    await
                    SalesOrderLine0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setSales_order)
                {
                    await
                    SalesOrderLine1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setSales_order)
                {
                    await
                    SalesOrderLine2.
                    setSales_order(relatedSales_order2);
                }
            
        }
        
    
        
            
            async function associateSalesOrderLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setProduct)
                {
                    await
                    SalesOrderLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setProduct)
                {
                    await
                    SalesOrderLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setProduct)
                {
                    await
                    SalesOrderLine2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInvoiceWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCompany)
                {
                    await
                    Invoice0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCompany)
                {
                    await
                    Invoice1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCompany)
                {
                    await
                    Invoice2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setSales_order)
                {
                    await
                    Invoice0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setSales_order)
                {
                    await
                    Invoice1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setSales_order)
                {
                    await
                    Invoice2.
                    setSales_order(relatedSales_order2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCustomer)
                {
                    await
                    Invoice0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCustomer)
                {
                    await
                    Invoice1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCustomer)
                {
                    await
                    Invoice2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associatePaymentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCompany)
                {
                    await
                    Payment0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCompany)
                {
                    await
                    Payment1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCompany)
                {
                    await
                    Payment2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setInvoice)
                {
                    await
                    Payment0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setInvoice)
                {
                    await
                    Payment1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setInvoice)
                {
                    await
                    Payment2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCustomer)
                {
                    await
                    Payment0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCustomer)
                {
                    await
                    Payment1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCustomer)
                {
                    await
                    Payment2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCrmPipelineWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CrmPipeline0 = await CrmPipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CrmPipeline0?.setCompany)
                {
                    await
                    CrmPipeline0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CrmPipeline1 = await CrmPipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CrmPipeline1?.setCompany)
                {
                    await
                    CrmPipeline1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CrmPipeline2 = await CrmPipelines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CrmPipeline2?.setCompany)
                {
                    await
                    CrmPipeline2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCrmStageWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CrmStage0 = await CrmStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CrmStage0?.setCompany)
                {
                    await
                    CrmStage0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CrmStage1 = await CrmStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CrmStage1?.setCompany)
                {
                    await
                    CrmStage1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CrmStage2 = await CrmStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CrmStage2?.setCompany)
                {
                    await
                    CrmStage2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateCrmStageWithPipeline() {
            
                const relatedPipeline0 = await CrmPipelines.findOne({
                    offset: Math.floor(Math.random() * (await CrmPipelines.count())),
                });
                const CrmStage0 = await CrmStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CrmStage0?.setPipeline)
                {
                    await
                    CrmStage0.
                    setPipeline(relatedPipeline0);
                }
            
                const relatedPipeline1 = await CrmPipelines.findOne({
                    offset: Math.floor(Math.random() * (await CrmPipelines.count())),
                });
                const CrmStage1 = await CrmStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CrmStage1?.setPipeline)
                {
                    await
                    CrmStage1.
                    setPipeline(relatedPipeline1);
                }
            
                const relatedPipeline2 = await CrmPipelines.findOne({
                    offset: Math.floor(Math.random() * (await CrmPipelines.count())),
                });
                const CrmStage2 = await CrmStages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CrmStage2?.setPipeline)
                {
                    await
                    CrmStage2.
                    setPipeline(relatedPipeline2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateLeadWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setCompany)
                {
                    await
                    Lead0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setCompany)
                {
                    await
                    Lead1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setCompany)
                {
                    await
                    Lead2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateLeadWithPipeline() {
            
                const relatedPipeline0 = await CrmPipelines.findOne({
                    offset: Math.floor(Math.random() * (await CrmPipelines.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setPipeline)
                {
                    await
                    Lead0.
                    setPipeline(relatedPipeline0);
                }
            
                const relatedPipeline1 = await CrmPipelines.findOne({
                    offset: Math.floor(Math.random() * (await CrmPipelines.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setPipeline)
                {
                    await
                    Lead1.
                    setPipeline(relatedPipeline1);
                }
            
                const relatedPipeline2 = await CrmPipelines.findOne({
                    offset: Math.floor(Math.random() * (await CrmPipelines.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setPipeline)
                {
                    await
                    Lead2.
                    setPipeline(relatedPipeline2);
                }
            
        }
        
    
        
            
            async function associateLeadWithStage() {
            
                const relatedStage0 = await CrmStages.findOne({
                    offset: Math.floor(Math.random() * (await CrmStages.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setStage)
                {
                    await
                    Lead0.
                    setStage(relatedStage0);
                }
            
                const relatedStage1 = await CrmStages.findOne({
                    offset: Math.floor(Math.random() * (await CrmStages.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setStage)
                {
                    await
                    Lead1.
                    setStage(relatedStage1);
                }
            
                const relatedStage2 = await CrmStages.findOne({
                    offset: Math.floor(Math.random() * (await CrmStages.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setStage)
                {
                    await
                    Lead2.
                    setStage(relatedStage2);
                }
            
        }
        
    
        
            
            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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            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);
                }
            
        }
        
    
        
            
            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);
                }
            
        }
        
    
        
            
            async function associateActivityWithAssigned_to() {
            
                const relatedAssigned_to0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity0 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Activity0?.setAssigned_to)
                {
                    await
                    Activity0.
                    setAssigned_to(relatedAssigned_to0);
                }
            
                const relatedAssigned_to1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity1 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Activity1?.setAssigned_to)
                {
                    await
                    Activity1.
                    setAssigned_to(relatedAssigned_to1);
                }
            
                const relatedAssigned_to2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Activity2 = await Activities.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Activity2?.setAssigned_to)
                {
                    await
                    Activity2.
                    setAssigned_to(relatedAssigned_to2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateContentFolderWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentFolder0 = await ContentFolders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentFolder0?.setCompany)
                {
                    await
                    ContentFolder0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentFolder1 = await ContentFolders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentFolder1?.setCompany)
                {
                    await
                    ContentFolder1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentFolder2 = await ContentFolders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentFolder2?.setCompany)
                {
                    await
                    ContentFolder2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateContentFolderWithParent_folder() {
            
                const relatedParent_folder0 = await ContentFolders.findOne({
                    offset: Math.floor(Math.random() * (await ContentFolders.count())),
                });
                const ContentFolder0 = await ContentFolders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentFolder0?.setParent_folder)
                {
                    await
                    ContentFolder0.
                    setParent_folder(relatedParent_folder0);
                }
            
                const relatedParent_folder1 = await ContentFolders.findOne({
                    offset: Math.floor(Math.random() * (await ContentFolders.count())),
                });
                const ContentFolder1 = await ContentFolders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentFolder1?.setParent_folder)
                {
                    await
                    ContentFolder1.
                    setParent_folder(relatedParent_folder1);
                }
            
                const relatedParent_folder2 = await ContentFolders.findOne({
                    offset: Math.floor(Math.random() * (await ContentFolders.count())),
                });
                const ContentFolder2 = await ContentFolders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentFolder2?.setParent_folder)
                {
                    await
                    ContentFolder2.
                    setParent_folder(relatedParent_folder2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateContentItemWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentItem0 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentItem0?.setCompany)
                {
                    await
                    ContentItem0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentItem1 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentItem1?.setCompany)
                {
                    await
                    ContentItem1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentItem2 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentItem2?.setCompany)
                {
                    await
                    ContentItem2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateContentItemWithBusiness_unit() {
            
                const relatedBusiness_unit0 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const ContentItem0 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentItem0?.setBusiness_unit)
                {
                    await
                    ContentItem0.
                    setBusiness_unit(relatedBusiness_unit0);
                }
            
                const relatedBusiness_unit1 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const ContentItem1 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentItem1?.setBusiness_unit)
                {
                    await
                    ContentItem1.
                    setBusiness_unit(relatedBusiness_unit1);
                }
            
                const relatedBusiness_unit2 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const ContentItem2 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentItem2?.setBusiness_unit)
                {
                    await
                    ContentItem2.
                    setBusiness_unit(relatedBusiness_unit2);
                }
            
        }
        
    
        
            
            async function associateContentItemWithFolder() {
            
                const relatedFolder0 = await ContentFolders.findOne({
                    offset: Math.floor(Math.random() * (await ContentFolders.count())),
                });
                const ContentItem0 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentItem0?.setFolder)
                {
                    await
                    ContentItem0.
                    setFolder(relatedFolder0);
                }
            
                const relatedFolder1 = await ContentFolders.findOne({
                    offset: Math.floor(Math.random() * (await ContentFolders.count())),
                });
                const ContentItem1 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentItem1?.setFolder)
                {
                    await
                    ContentItem1.
                    setFolder(relatedFolder1);
                }
            
                const relatedFolder2 = await ContentFolders.findOne({
                    offset: Math.floor(Math.random() * (await ContentFolders.count())),
                });
                const ContentItem2 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentItem2?.setFolder)
                {
                    await
                    ContentItem2.
                    setFolder(relatedFolder2);
                }
            
        }
        
    
        
            
            async function associateContentItemWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ContentItem0 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentItem0?.setOwner)
                {
                    await
                    ContentItem0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ContentItem1 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentItem1?.setOwner)
                {
                    await
                    ContentItem1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ContentItem2 = await ContentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentItem2?.setOwner)
                {
                    await
                    ContentItem2.
                    setOwner(relatedOwner2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateSeoKeywordWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SeoKeyword0 = await SeoKeywords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SeoKeyword0?.setCompany)
                {
                    await
                    SeoKeyword0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SeoKeyword1 = await SeoKeywords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SeoKeyword1?.setCompany)
                {
                    await
                    SeoKeyword1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const SeoKeyword2 = await SeoKeywords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SeoKeyword2?.setCompany)
                {
                    await
                    SeoKeyword2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateSeoKeywordWithBusiness_unit() {
            
                const relatedBusiness_unit0 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const SeoKeyword0 = await SeoKeywords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SeoKeyword0?.setBusiness_unit)
                {
                    await
                    SeoKeyword0.
                    setBusiness_unit(relatedBusiness_unit0);
                }
            
                const relatedBusiness_unit1 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const SeoKeyword1 = await SeoKeywords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SeoKeyword1?.setBusiness_unit)
                {
                    await
                    SeoKeyword1.
                    setBusiness_unit(relatedBusiness_unit1);
                }
            
                const relatedBusiness_unit2 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const SeoKeyword2 = await SeoKeywords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SeoKeyword2?.setBusiness_unit)
                {
                    await
                    SeoKeyword2.
                    setBusiness_unit(relatedBusiness_unit2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateContentCampaignWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentCampaign0 = await ContentCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentCampaign0?.setCompany)
                {
                    await
                    ContentCampaign0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentCampaign1 = await ContentCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentCampaign1?.setCompany)
                {
                    await
                    ContentCampaign1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ContentCampaign2 = await ContentCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentCampaign2?.setCompany)
                {
                    await
                    ContentCampaign2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateContentCampaignWithBusiness_unit() {
            
                const relatedBusiness_unit0 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const ContentCampaign0 = await ContentCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ContentCampaign0?.setBusiness_unit)
                {
                    await
                    ContentCampaign0.
                    setBusiness_unit(relatedBusiness_unit0);
                }
            
                const relatedBusiness_unit1 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const ContentCampaign1 = await ContentCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ContentCampaign1?.setBusiness_unit)
                {
                    await
                    ContentCampaign1.
                    setBusiness_unit(relatedBusiness_unit1);
                }
            
                const relatedBusiness_unit2 = await BusinessUnits.findOne({
                    offset: Math.floor(Math.random() * (await BusinessUnits.count())),
                });
                const ContentCampaign2 = await ContentCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ContentCampaign2?.setBusiness_unit)
                {
                    await
                    ContentCampaign2.
                    setBusiness_unit(relatedBusiness_unit2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateDashboardWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Dashboard0 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Dashboard0?.setCompany)
                {
                    await
                    Dashboard0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Dashboard1 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Dashboard1?.setCompany)
                {
                    await
                    Dashboard1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Dashboard2 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Dashboard2?.setCompany)
                {
                    await
                    Dashboard2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateDashboardWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Dashboard0 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Dashboard0?.setOwner)
                {
                    await
                    Dashboard0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Dashboard1 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Dashboard1?.setOwner)
                {
                    await
                    Dashboard1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Dashboard2 = await Dashboards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Dashboard2?.setOwner)
                {
                    await
                    Dashboard2.
                    setOwner(relatedOwner2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateReportWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setCompany)
                {
                    await
                    Report0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setCompany)
                {
                    await
                    Report1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setCompany)
                {
                    await
                    Report2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Companies.bulkCreate(CompaniesData);
                
            
            
                
                await BusinessUnits.bulkCreate(BusinessUnitsData);
                
            
            
                
                await Tags.bulkCreate(TagsData);
                
            
            
                
                await Assets.bulkCreate(AssetsData);
                
            
            
                
                await Tenants.bulkCreate(TenantsData);
                
            
            
                
                await Leases.bulkCreate(LeasesData);
                
            
            
                
                await WorkOrders.bulkCreate(WorkOrdersData);
                
            
            
                
                await Products.bulkCreate(ProductsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await InventoryItems.bulkCreate(InventoryItemsData);
                
            
            
                
                await InventoryTransactions.bulkCreate(InventoryTransactionsData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await SalesOrders.bulkCreate(SalesOrdersData);
                
            
            
                
                await SalesOrderLines.bulkCreate(SalesOrderLinesData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await CrmPipelines.bulkCreate(CrmPipelinesData);
                
            
            
                
                await CrmStages.bulkCreate(CrmStagesData);
                
            
            
                
                await Leads.bulkCreate(LeadsData);
                
            
            
                
                await Activities.bulkCreate(ActivitiesData);
                
            
            
                
                await ContentFolders.bulkCreate(ContentFoldersData);
                
            
            
                
                await ContentItems.bulkCreate(ContentItemsData);
                
            
            
                
                await SeoKeywords.bulkCreate(SeoKeywordsData);
                
            
            
                
                await ContentCampaigns.bulkCreate(ContentCampaignsData);
                
            
            
                
                await Dashboards.bulkCreate(DashboardsData);
                
            
            
                
                await Reports.bulkCreate(ReportsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithCompany(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateBusinessUnitWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTagWithCompany(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAssetWithCompany(),
                    
                
                    
                        
                        await associateAssetWithBusiness_unit(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateTenantWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateLeasWithCompany(),
                    
                
                    
                        
                        await associateLeasWithAsset(),
                    
                
                    
                        
                        await associateLeasWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWorkOrderWithCompany(),
                    
                
                    
                        
                        await associateWorkOrderWithAsset(),
                    
                
                    
                        
                        await associateWorkOrderWithAssigned_to(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductWithCompany(),
                    
                
                    
                        
                        await associateProductWithBusiness_unit(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateWarehousWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryItemWithCompany(),
                    
                
                    
                        
                        await associateInventoryItemWithProduct(),
                    
                
                    
                        
                        await associateInventoryItemWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryTransactionWithCompany(),
                    
                
                    
                        
                        await associateInventoryTransactionWithProduct(),
                    
                
                    
                        
                        await associateInventoryTransactionWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCustomerWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateSalesOrderWithCompany(),
                    
                
                    
                        
                        await associateSalesOrderWithBusiness_unit(),
                    
                
                    
                        
                        await associateSalesOrderWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSalesOrderLineWithCompany(),
                    
                
                    
                        
                        await associateSalesOrderLineWithSales_order(),
                    
                
                    
                        
                        await associateSalesOrderLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithCompany(),
                    
                
                    
                        
                        await associateInvoiceWithSales_order(),
                    
                
                    
                        
                        await associateInvoiceWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associatePaymentWithCompany(),
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                        
                        await associatePaymentWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCrmPipelineWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCrmStageWithCompany(),
                    
                
                    
                        
                        await associateCrmStageWithPipeline(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateLeadWithCompany(),
                    
                
                    
                        
                        await associateLeadWithPipeline(),
                    
                
                    
                        
                        await associateLeadWithStage(),
                    
                
                    
                        
                        await associateLeadWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateActivityWithCompany(),
                    
                
                    
                        
                        await associateActivityWithLead(),
                    
                
                    
                        
                        await associateActivityWithAssigned_to(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateContentFolderWithCompany(),
                    
                
                    
                        
                        await associateContentFolderWithParent_folder(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateContentItemWithCompany(),
                    
                
                    
                        
                        await associateContentItemWithBusiness_unit(),
                    
                
                    
                        
                        await associateContentItemWithFolder(),
                    
                
                    
                        
                        await associateContentItemWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateSeoKeywordWithCompany(),
                    
                
                    
                        
                        await associateSeoKeywordWithBusiness_unit(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateContentCampaignWithCompany(),
                    
                
                    
                        
                        await associateContentCampaignWithBusiness_unit(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateDashboardWithCompany(),
                    
                
                    
                
                    
                
                    
                        
                        await associateDashboardWithOwner(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateReportWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('companies', null, {});
            
            
            await queryInterface.bulkDelete('business_units', null, {});
            
            
            await queryInterface.bulkDelete('tags', null, {});
            
            
            await queryInterface.bulkDelete('assets', null, {});
            
            
            await queryInterface.bulkDelete('tenants', null, {});
            
            
            await queryInterface.bulkDelete('leases', null, {});
            
            
            await queryInterface.bulkDelete('work_orders', null, {});
            
            
            await queryInterface.bulkDelete('products', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('inventory_items', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transactions', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('sales_orders', null, {});
            
            
            await queryInterface.bulkDelete('sales_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('crm_pipelines', null, {});
            
            
            await queryInterface.bulkDelete('crm_stages', null, {});
            
            
            await queryInterface.bulkDelete('leads', null, {});
            
            
            await queryInterface.bulkDelete('activities', null, {});
            
            
            await queryInterface.bulkDelete('content_folders', null, {});
            
            
            await queryInterface.bulkDelete('content_items', null, {});
            
            
            await queryInterface.bulkDelete('seo_keywords', null, {});
            
            
            await queryInterface.bulkDelete('content_campaigns', null, {});
            
            
            await queryInterface.bulkDelete('dashboards', null, {});
            
            
            await queryInterface.bulkDelete('reports', null, {});
            
        
    },
};