





















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






const RolePermissions = db.role_permissions;

const Clients = db.clients;

const Suppliers = db.suppliers;

const Categories = db.categories;

const Products = db.products;

const StockMovements = db.stock_movements;

const Quotes = db.quotes;

const QuoteItems = db.quote_items;

const Sales = db.sales;

const SaleItems = db.sale_items;

const Invoices = db.invoices;

const InvoiceItems = db.invoice_items;

const Payments = db.payments;

const Expenses = db.expenses;

const CashMovements = db.cash_movements;

const PoultryLots = db.poultry_lots;

const EggCollections = db.egg_collections;

const Treatments = db.treatments;

const Alerts = db.alerts;

const Settings = db.settings;

const AuditLogs = db.audit_logs;







const RolePermissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allowed": true,
            
        
    
    },
    
];



const ClientsData = [
    
    {
    
        
        
            
                "code": "CL-0001",
            
        
    
        
        
            
                "name": "Restaurant Le Teranga",
            
        
    
        
        
            
                "type": "individual",
            
        
    
        
        
            
                "phone": "+221771112233",
            
        
    
        
        
            
                "email": "achats@leteranga.sn",
            
        
    
        
        
            
                "address": "Avenue Cheikh Anta Diop, Dakar",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-RT-102938",
            
        
    
        
        
            
                "credit_limit": 1500000,
            
        
    
        
        
            
                "opening_balance": 0,
            
        
    
        
        
            
                "notes": "Client B2B pour oeufs et viande.",
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CL-0002",
            
        
    
        
        
            
                "name": "Boutique Bio Almadies",
            
        
    
        
        
            
                "type": "business",
            
        
    
        
        
            
                "phone": "+221772223344",
            
        
    
        
        
            
                "email": "contact@biolmadies.sn",
            
        
    
        
        
            
                "address": "Route des Almadies, Dakar",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-BIO-564738",
            
        
    
        
        
            
                "credit_limit": 800000,
            
        
    
        
        
            
                "opening_balance": 50000,
            
        
    
        
        
            
                "notes": "Commande recurrente plateaux oeufs.",
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CL-0003",
            
        
    
        
        
            
                "name": "Mame Diarra Sow",
            
        
    
        
        
            
                "type": "business",
            
        
    
        
        
            
                "phone": "+221773334455",
            
        
    
        
        
            
                "email": "mame.sow@gmail.com",
            
        
    
        
        
            
                "address": "Parcelles Assainies, Unite 16",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NA",
            
        
    
        
        
            
                "credit_limit": 0,
            
        
    
        
        
            
                "opening_balance": 0,
            
        
    
        
        
            
                "notes": "Achats ponctuels cailles vivantes.",
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CL-0004",
            
        
    
        
        
            
                "name": "Hotel Saly Beach",
            
        
    
        
        
            
                "type": "business",
            
        
    
        
        
            
                "phone": "+221774445566",
            
        
    
        
        
            
                "email": "procurement@salybeach.sn",
            
        
    
        
        
            
                "address": "Route de Saly, Mbour",
            
        
    
        
        
            
                "city": "Mbour",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-HSB-019283",
            
        
    
        
        
            
                "credit_limit": 1200000,
            
        
    
        
        
            
                "opening_balance": 0,
            
        
    
        
        
            
                "notes": "Preferer livraison matin.",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                "code": "FR-0001",
            
        
    
        
        
            
                "name": "SEN ALIMENTS",
            
        
    
        
        
            
                "contact_name": "Cheikh Gueye",
            
        
    
        
        
            
                "phone": "+221781112233",
            
        
    
        
        
            
                "email": "sales@senaliments.sn",
            
        
    
        
        
            
                "address": "Zone Industrielle, Rufisque",
            
        
    
        
        
            
                "city": "Rufisque",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-SAL-998877",
            
        
    
        
        
            
                "notes": "Fournisseur aliment volaille sacs 25kg.",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                "code": "FR-0002",
            
        
    
        
        
            
                "name": "PharmaVet Dakar",
            
        
    
        
        
            
                "contact_name": "Aissatou Diallo",
            
        
    
        
        
            
                "phone": "+221782223344",
            
        
    
        
        
            
                "email": "contact@pharmavet.sn",
            
        
    
        
        
            
                "address": "Medina, Dakar",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-PVD-112233",
            
        
    
        
        
            
                "notes": "Vaccins et vitamines, livraison 48h.",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                "code": "FR-0003",
            
        
    
        
        
            
                "name": "Emballages du Sahel",
            
        
    
        
        
            
                "contact_name": "Babacar Faye",
            
        
    
        
        
            
                "phone": "+221783334455",
            
        
    
        
        
            
                "email": "commercial@embsahel.sn",
            
        
    
        
        
            
                "address": "Km 7,5 Route de Rufisque",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-EDS-223344",
            
        
    
        
        
            
                "notes": "Boites oeufs, cartons et etiquettes.",
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "code": "FR-0004",
            
        
    
        
        
            
                "name": "Quincaillerie Keur Massar",
            
        
    
        
        
            
                "contact_name": "Ousmane Ndour",
            
        
    
        
        
            
                "phone": "+221784445566",
            
        
    
        
        
            
                "email": "keurmassar.quincaillerie@gmail.com",
            
        
    
        
        
            
                "address": "Keur Massar",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-QKM-334455",
            
        
    
        
        
            
                "notes": "Materiel maintenance et petit equipement.",
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
];



const CategoriesData = [
    
    {
    
        
        
            
                "name": "Cailles vivantes",
            
        
    
        
        
            
                "description": "Vente de cailles vivantes.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Oeufs",
            
        
    
        
        
            
                "description": "Oeufs de caille frais.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Viande",
            
        
    
        
        
            
                "description": "Viande de caille preparee.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Produits elevage",
            
        
    
        
        
            
                "description": "Materiel et fournitures elevage.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
];



const ProductsData = [
    
    {
    
        
        
            
                "sku": "CAV-001",
            
        
    
        
        
            
                "name": "Caille vivante adulte",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_type": "live_quail",
            
        
    
        
        
            
                "unit": "g",
            
        
    
        
        
            
                "sale_price": 1200,
            
        
    
        
        
            
                "purchase_price": 0,
            
        
    
        
        
            
                "vat_rate": 0,
            
        
    
        
        
            
                "low_stock_threshold": 50,
            
        
    
        
        
            
                "track_stock": true,
            
        
    
        
        
            
                "description": "Caille adulte vivante, selection elevage.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                "sku": "OEU-012",
            
        
    
        
        
            
                "name": "Plateau oeufs de caille 12",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_type": "other",
            
        
    
        
        
            
                "unit": "tray",
            
        
    
        
        
            
                "sale_price": 1500,
            
        
    
        
        
            
                "purchase_price": 0,
            
        
    
        
        
            
                "vat_rate": 0,
            
        
    
        
        
            
                "low_stock_threshold": 30,
            
        
    
        
        
            
                "track_stock": true,
            
        
    
        
        
            
                "description": "Plateau de 12 oeufs frais.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                "sku": "OEU-030",
            
        
    
        
        
            
                "name": "Plateau oeufs de caille 30",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_type": "breeding_supply",
            
        
    
        
        
            
                "unit": "tray",
            
        
    
        
        
            
                "sale_price": 3200,
            
        
    
        
        
            
                "purchase_price": 0,
            
        
    
        
        
            
                "vat_rate": 0,
            
        
    
        
        
            
                "low_stock_threshold": 20,
            
        
    
        
        
            
                "track_stock": true,
            
        
    
        
        
            
                "description": "Plateau de 30 oeufs frais.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                "sku": "VIA-001",
            
        
    
        
        
            
                "name": "Viande de caille nettoyee 1kg",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_type": "eggs",
            
        
    
        
        
            
                "unit": "piece",
            
        
    
        
        
            
                "sale_price": 8500,
            
        
    
        
        
            
                "purchase_price": 0,
            
        
    
        
        
            
                "vat_rate": 0,
            
        
    
        
        
            
                "low_stock_threshold": 10,
            
        
    
        
        
            
                "track_stock": true,
            
        
    
        
        
            
                "description": "Viande de caille preparee et conditionnee.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
];



const StockMovementsData = [
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-01T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "adjustment",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_cost": 10500,
            
        
    
        
        
            
                "reference": "SM-2026-0001",
            
        
    
        
        
            
                "reason": "Reception fournisseur",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-03T15:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "out",
            
        
    
        
        
            
                "quantity": 60,
            
        
    
        
        
            
                "unit_cost": 0,
            
        
    
        
        
            
                "reference": "SM-2026-0002",
            
        
    
        
        
            
                "reason": "Production interne",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-04T11:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "in",
            
        
    
        
        
            
                "quantity": 15,
            
        
    
        
        
            
                "unit_cost": 0,
            
        
    
        
        
            
                "reference": "SM-2026-0003",
            
        
    
        
        
            
                "reason": "Vente client",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-06T08:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "adjustment",
            
        
    
        
        
            
                "quantity": 40,
            
        
    
        
        
            
                "unit_cost": 0,
            
        
    
        
        
            
                "reference": "SM-2026-0004",
            
        
    
        
        
            
                "reason": "Vente client",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const QuotesData = [
    
    {
    
        
        
            
                "number": "DEV-2026-0001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-02T10:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-12T23:59:59Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "subtotal": 32000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 32000,
            
        
    
        
        
            
                "notes": "Livraison a Dakar Plateau.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "DEV-2026-0002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-03T09:30:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-13T23:59:59Z'),
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "subtotal": 68000,
            
        
    
        
        
            
                "discount_total": 2000,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 66000,
            
        
    
        
        
            
                "notes": "Conditionnement isotherme requis.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "DEV-2026-0003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-05T14:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-15T23:59:59Z'),
            
        
    
        
        
            
                "status": "converted",
            
        
    
        
        
            
                "subtotal": 24000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 24000,
            
        
    
        
        
            
                "notes": "Paiement a la livraison.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "DEV-2026-0004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-07T11:45:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-17T23:59:59Z'),
            
        
    
        
        
            
                "status": "converted",
            
        
    
        
        
            
                "subtotal": 42500,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 42500,
            
        
    
        
        
            
                "notes": "Prix a confirmer selon dispo.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const QuoteItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 30",
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                "unit_price": 3200,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 32000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 12",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_price": 1500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 30000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Viande de caille 1kg",
            
        
    
        
        
            
                "quantity": 4,
            
        
    
        
        
            
                "unit_price": 8500,
            
        
    
        
        
            
                "discount_rate": 5,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 32300,
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 12",
            
        
    
        
        
            
                "quantity": 16,
            
        
    
        
        
            
                "unit_price": 1500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 24000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
];



const SalesData = [
    
    {
    
        
        
            
                "number": "VEN-2026-0001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sale_date": new Date('2026-06-04T11:05:00Z'),
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "subtotal": 22500,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 22500,
            
        
    
        
        
            
                "payment_status": "paid",
            
        
    
        
        
            
                "notes": "Livraison effectuee par coursier.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "VEN-2026-0002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sale_date": new Date('2026-06-06T08:15:00Z'),
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "subtotal": 48000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 48000,
            
        
    
        
        
            
                "payment_status": "unpaid",
            
        
    
        
        
            
                "notes": "Vente comptant.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "VEN-2026-0003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sale_date": new Date('2026-06-07T13:20:00Z'),
            
        
    
        
        
            
                "status": "delivered",
            
        
    
        
        
            
                "subtotal": 32000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 32000,
            
        
    
        
        
            
                "payment_status": "paid",
            
        
    
        
        
            
                "notes": "Facture a emettre.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "VEN-2026-0004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sale_date": new Date('2026-06-08T09:10:00Z'),
            
        
    
        
        
            
                "status": "confirmed",
            
        
    
        
        
            
                "subtotal": 66000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 66000,
            
        
    
        
        
            
                "payment_status": "refunded",
            
        
    
        
        
            
                "notes": "Commande en preparation.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SaleItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 12",
            
        
    
        
        
            
                "quantity": 15,
            
        
    
        
        
            
                "unit_price": 1500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 22500,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Caille vivante adulte",
            
        
    
        
        
            
                "quantity": 40,
            
        
    
        
        
            
                "unit_price": 1200,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 48000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 30",
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                "unit_price": 3200,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 32000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Viande de caille 1kg",
            
        
    
        
        
            
                "quantity": 4,
            
        
    
        
        
            
                "unit_price": 8500,
            
        
    
        
        
            
                "discount_rate": 3,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 32980,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                "number": "FAC-2026-0001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-04T12:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-11T23:59:59Z'),
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "subtotal": 22500,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 22500,
            
        
    
        
        
            
                "amount_paid": 10000,
            
        
    
        
        
            
                "amount_due": 12500,
            
        
    
        
        
            
                "notes": "Solde a regler sous 7 jours.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "FAC-2026-0002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-06T08:20:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-06T23:59:59Z'),
            
        
    
        
        
            
                "status": "refunded",
            
        
    
        
        
            
                "subtotal": 48000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 48000,
            
        
    
        
        
            
                "amount_paid": 48000,
            
        
    
        
        
            
                "amount_due": 0,
            
        
    
        
        
            
                "notes": "Payee comptant.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "FAC-2026-0003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-07T15:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-17T23:59:59Z'),
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "subtotal": 32000,
            
        
    
        
        
            
                "discount_total": 0,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 32000,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "amount_due": 32000,
            
        
    
        
        
            
                "notes": "Paiement par virement bancaire.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "number": "FAC-2026-0004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-06-08T10:30:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-06-22T23:59:59Z'),
            
        
    
        
        
            
                "status": "refunded",
            
        
    
        
        
            
                "subtotal": 68000,
            
        
    
        
        
            
                "discount_total": 2000,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 66000,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "amount_due": 66000,
            
        
    
        
        
            
                "notes": "Conditions: 14 jours.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoiceItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 12",
            
        
    
        
        
            
                "quantity": 15,
            
        
    
        
        
            
                "unit_price": 1500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 22500,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Caille vivante adulte",
            
        
    
        
        
            
                "quantity": 40,
            
        
    
        
        
            
                "unit_price": 1200,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 48000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 30",
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                "unit_price": 3200,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 32000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Plateau oeufs 12",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_price": 1500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "tax_rate": 0,
            
        
    
        
        
            
                "line_total": 30000,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                "reference": "PAY-2026-0001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-06-04T12:10:00Z'),
            
        
    
        
        
            
                "amount": 10000,
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "provider_transaction_ref": "WAVE-8F3K21",
            
        
    
        
        
            
                "notes": "Acompte recu.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "reference": "PAY-2026-0002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-06-06T08:25:00Z'),
            
        
    
        
        
            
                "amount": 48000,
            
        
    
        
        
            
                "method": "wave",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "provider_transaction_ref": "CASH-20260606-01",
            
        
    
        
        
            
                "notes": "Paiement comptant.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "reference": "PAY-2026-0003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-06-10T09:05:00Z'),
            
        
    
        
        
            
                "amount": 16000,
            
        
    
        
        
            
                "method": "orange_money",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "provider_transaction_ref": "BANK-TRX-119922",
            
        
    
        
        
            
                "notes": "Paiement partiel virement.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "reference": "PAY-2026-0004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "paid_at": new Date('2026-06-09T18:30:00Z'),
            
        
    
        
        
            
                "amount": 20000,
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "provider_transaction_ref": "OM-REF-445512",
            
        
    
        
        
            
                "notes": "En attente confirmation operateur.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ExpensesData = [
    
    {
    
        
        
            
                "reference": "DEP-2026-0001",
            
        
    
        
        
            
                "category": "salary",
            
        
    
        
        
            
                "expense_date": new Date('2026-06-01T10:00:00Z'),
            
        
    
        
        
            
                "amount": 210000,
            
        
    
        
        
            
                "payment_method": "cheque",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Achat aliment ponte 20 sacs.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
    },
    
    {
    
        
        
            
                "reference": "DEP-2026-0002",
            
        
    
        
        
            
                "category": "other",
            
        
    
        
        
            
                "expense_date": new Date('2026-06-02T16:20:00Z'),
            
        
    
        
        
            
                "amount": 85000,
            
        
    
        
        
            
                "payment_method": "wave",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Vaccins et vitamines lot Juin.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
    },
    
    {
    
        
        
            
                "reference": "DEP-2026-0003",
            
        
    
        
        
            
                "category": "salary",
            
        
    
        
        
            
                "expense_date": new Date('2026-06-04T07:30:00Z'),
            
        
    
        
        
            
                "amount": 15000,
            
        
    
        
        
            
                "payment_method": "cash",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Livraison clients Dakar.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "paid",
            
        
    
    },
    
    {
    
        
        
            
                "reference": "DEP-2026-0004",
            
        
    
        
        
            
                "category": "rent",
            
        
    
        
        
            
                "expense_date": new Date('2026-06-05T12:00:00Z'),
            
        
    
        
        
            
                "amount": 32000,
            
        
    
        
        
            
                "payment_method": "bank_transfer",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Recharge eau et electricite batiment elevage.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "paid",
            
        
    
    },
    
];



const CashMovementsData = [
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-04T12:10:00Z'),
            
        
    
        
        
            
                "direction": "out",
            
        
    
        
        
            
                "amount": 10000,
            
        
    
        
        
            
                "method": "orange_money",
            
        
    
        
        
            
                "source_type": "expense",
            
        
    
        
        
            
                "reference": "CM-2026-0001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Encaissement acompte FAC-2026-0001.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-06T08:25:00Z'),
            
        
    
        
        
            
                "direction": "out",
            
        
    
        
        
            
                "amount": 48000,
            
        
    
        
        
            
                "method": "wave",
            
        
    
        
        
            
                "source_type": "adjustment",
            
        
    
        
        
            
                "reference": "CM-2026-0002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Encaissement comptant FAC-2026-0002.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-01T10:00:00Z'),
            
        
    
        
        
            
                "direction": "out",
            
        
    
        
        
            
                "amount": 210000,
            
        
    
        
        
            
                "method": "cash",
            
        
    
        
        
            
                "source_type": "payment",
            
        
    
        
        
            
                "reference": "CM-2026-0003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Paiement fournisseur aliment.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_at": new Date('2026-06-04T07:30:00Z'),
            
        
    
        
        
            
                "direction": "out",
            
        
    
        
        
            
                "amount": 15000,
            
        
    
        
        
            
                "method": "cheque",
            
        
    
        
        
            
                "source_type": "expense",
            
        
    
        
        
            
                "reference": "CM-2026-0004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Frais livraison Dakar.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PoultryLotsData = [
    
    {
    
        
        
            
                "code": "LOT-2026-01",
            
        
    
        
        
            
                "name": "Lot Ponte A",
            
        
    
        
        
            
                "start_date": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "initial_count": 1200,
            
        
    
        
        
            
                "current_count": 1145,
            
        
    
        
        
            
                "deaths_count": 55,
            
        
    
        
        
            
                "mortality_rate": 4.58,
            
        
    
        
        
            
                "housing_location": "Batiment 1 - Rangee A",
            
        
    
        
        
            
                "notes": "Lot principal de ponte.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "code": "LOT-2026-02",
            
        
    
        
        
            
                "name": "Lot Croissance B",
            
        
    
        
        
            
                "start_date": new Date('2026-05-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "initial_count": 800,
            
        
    
        
        
            
                "current_count": 780,
            
        
    
        
        
            
                "deaths_count": 20,
            
        
    
        
        
            
                "mortality_rate": 2.5,
            
        
    
        
        
            
                "housing_location": "Batiment 2 - Rangee B",
            
        
    
        
        
            
                "notes": "Jeunes cailles en croissance.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "code": "LOT-2026-03",
            
        
    
        
        
            
                "name": "Lot Quarantaine C",
            
        
    
        
        
            
                "start_date": new Date('2026-05-25T00:00:00Z'),
            
        
    
        
        
            
                "status": "quarantine",
            
        
    
        
        
            
                "initial_count": 150,
            
        
    
        
        
            
                "current_count": 147,
            
        
    
        
        
            
                "deaths_count": 3,
            
        
    
        
        
            
                "mortality_rate": 2,
            
        
    
        
        
            
                "housing_location": "Zone quarantaine",
            
        
    
        
        
            
                "notes": "Surveillance suite arrivage.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "code": "LOT-2026-04",
            
        
    
        
        
            
                "name": "Lot Ponte D",
            
        
    
        
        
            
                "start_date": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "status": "quarantine",
            
        
    
        
        
            
                "initial_count": 1000,
            
        
    
        
        
            
                "current_count": 955,
            
        
    
        
        
            
                "deaths_count": 45,
            
        
    
        
        
            
                "mortality_rate": 4.5,
            
        
    
        
        
            
                "housing_location": "Batiment 1 - Rangee D",
            
        
    
        
        
            
                "notes": "Production stable.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EggCollectionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "collected_at": new Date('2026-06-03T06:30:00Z'),
            
        
    
        
        
            
                "quantity": 980,
            
        
    
        
        
            
                "broken_quantity": 12,
            
        
    
        
        
            
                "notes": "Collecte matin, tri effectue.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "collected_at": new Date('2026-06-04T06:25:00Z'),
            
        
    
        
        
            
                "quantity": 995,
            
        
    
        
        
            
                "broken_quantity": 9,
            
        
    
        
        
            
                "notes": "Bonne production.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "collected_at": new Date('2026-06-04T06:40:00Z'),
            
        
    
        
        
            
                "quantity": 820,
            
        
    
        
        
            
                "broken_quantity": 15,
            
        
    
        
        
            
                "notes": "Quelques casse dans rangee D.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "collected_at": new Date('2026-06-08T06:20:00Z'),
            
        
    
        
        
            
                "quantity": 970,
            
        
    
        
        
            
                "broken_quantity": 10,
            
        
    
        
        
            
                "notes": "Production stable.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TreatmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "treatment_type": "disinfection",
            
        
    
        
        
            
                "product_name": "Newcastle Vaccine",
            
        
    
        
        
            
                "dosage": "1 dose par litre eau",
            
        
    
        
        
            
                "administered_at": new Date('2026-06-02T07:00:00Z'),
            
        
    
        
        
            
                "next_due_at": new Date('2026-07-02T07:00:00Z'),
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "notes": "Administration par eau de boisson.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "treatment_type": "other",
            
        
    
        
        
            
                "product_name": "Vitamines AD3E",
            
        
    
        
        
            
                "dosage": "10 ml pour 10 litres",
            
        
    
        
        
            
                "administered_at": new Date('2026-06-05T07:15:00Z'),
            
        
    
        
        
            
                "next_due_at": new Date('2026-06-12T07:15:00Z'),
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                "notes": "Cure 3 jours.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "treatment_type": "medication",
            
        
    
        
        
            
                "product_name": "Anticoccidien",
            
        
    
        
        
            
                "dosage": "Selon notice",
            
        
    
        
        
            
                "administered_at": new Date('2026-06-06T07:30:00Z'),
            
        
    
        
        
            
                "next_due_at": new Date('2026-06-13T07:30:00Z'),
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "notes": "Surveillance appetit et fientes.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "treatment_type": "vitamins",
            
        
    
        
        
            
                "product_name": "Desinfectant batiment",
            
        
    
        
        
            
                "dosage": "Pulverisation 1:100",
            
        
    
        
        
            
                "administered_at": new Date('2026-06-08T17:00:00Z'),
            
        
    
        
        
            
                "next_due_at": new Date('2026-06-15T17:00:00Z'),
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "notes": "Pulverisation complete.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AlertsData = [
    
    {
    
        
        
            
                "type": "high_mortality",
            
        
    
        
        
            
                "severity": "warning",
            
        
    
        
        
            
                "title": "Stock bas aliment ponte",
            
        
    
        
        
            
                "message": "Le stock de Aliment ponte sac 25kg approche du seuil. Prevoir reappro.",
            
        
    
        
        
            
                "triggered_at": new Date('2026-06-09T09:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-12T09:00:00Z'),
            
        
    
        
        
            
                "status": "resolved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "type": "high_mortality",
            
        
    
        
        
            
                "severity": "warning",
            
        
    
        
        
            
                "title": "Facture en retard Boucherie Ndiaga",
            
        
    
        
        
            
                "message": "La facture FAC-2026-0005 est en retard. Relancer le client.",
            
        
    
        
        
            
                "triggered_at": new Date('2026-06-01T08:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-05T08:00:00Z'),
            
        
    
        
        
            
                "status": "dismissed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "type": "pending_delivery",
            
        
    
        
        
            
                "severity": "warning",
            
        
    
        
        
            
                "title": "Rappel vaccination Lot Ponte A",
            
        
    
        
        
            
                "message": "Un rappel de vaccination est planifie pour le Lot Ponte A.",
            
        
    
        
        
            
                "triggered_at": new Date('2026-06-10T07:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-11T07:00:00Z'),
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "type": "vaccination_due",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "title": "Mortalite a surveiller Lot Ponte D",
            
        
    
        
        
            
                "message": "Le taux de mortalite du lot D est a surveiller cette semaine.",
            
        
    
        
        
            
                "triggered_at": new Date('2026-06-08T18:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-12T18:00:00Z'),
            
        
    
        
        
            
                "status": "resolved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SettingsData = [
    
    {
    
        
        
            
                "company_name": "YAYE MATY AGRO",
            
        
    
        
        
            
                "legal_name": "YAYE MATY AGRO SARL",
            
        
    
        
        
            
                "address": "Keur Massar, Dakar, Senegal",
            
        
    
        
        
            
                "phone": "+221770000000",
            
        
    
        
        
            
                "email": "contact@yayematyagro.sn",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-YMA-123456",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "primary_color": "#0EA5E9",
            
        
    
        
        
            
                "secondary_color": "#1E293B",
            
        
    
        
        
            
                "theme": "dark",
            
        
    
        
        
            
                "invoice_prefix": "FAC",
            
        
    
        
        
            
                "quote_prefix": "DEV",
            
        
    
        
        
            
                "sale_prefix": "VEN",
            
        
    
        
        
            
                "invoice_next_number": 6,
            
        
    
        
        
            
                "quote_next_number": 6,
            
        
    
        
        
            
                "sale_next_number": 6,
            
        
    
        
        
            
                "invoice_footer_note": "Merci pour votre confiance. Paiement mobile accepte.",
            
        
    
    },
    
    {
    
        
        
            
                "company_name": "YAYE MATY AGRO",
            
        
    
        
        
            
                "legal_name": "YAYE MATY AGRO SARL",
            
        
    
        
        
            
                "address": "Keur Massar, Dakar, Senegal",
            
        
    
        
        
            
                "phone": "+221770000000",
            
        
    
        
        
            
                "email": "billing@yayematyagro.sn",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-YMA-123456",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "primary_color": "#22C55E",
            
        
    
        
        
            
                "secondary_color": "#0F172A",
            
        
    
        
        
            
                "theme": "light",
            
        
    
        
        
            
                "invoice_prefix": "FAC",
            
        
    
        
        
            
                "quote_prefix": "DEV",
            
        
    
        
        
            
                "sale_prefix": "VEN",
            
        
    
        
        
            
                "invoice_next_number": 7,
            
        
    
        
        
            
                "quote_next_number": 7,
            
        
    
        
        
            
                "sale_next_number": 7,
            
        
    
        
        
            
                "invoice_footer_note": "Coordonnees de paiement disponibles sur demande.",
            
        
    
    },
    
    {
    
        
        
            
                "company_name": "YAYE MATY AGRO",
            
        
    
        
        
            
                "legal_name": "YAYE MATY AGRO SARL",
            
        
    
        
        
            
                "address": "Keur Massar, Dakar, Senegal",
            
        
    
        
        
            
                "phone": "+221770000000",
            
        
    
        
        
            
                "email": "sales@yayematyagro.sn",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-YMA-123456",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "primary_color": "#F59E0B",
            
        
    
        
        
            
                "secondary_color": "#111827",
            
        
    
        
        
            
                "theme": "system",
            
        
    
        
        
            
                "invoice_prefix": "FAC",
            
        
    
        
        
            
                "quote_prefix": "DEV",
            
        
    
        
        
            
                "sale_prefix": "VEN",
            
        
    
        
        
            
                "invoice_next_number": 8,
            
        
    
        
        
            
                "quote_next_number": 8,
            
        
    
        
        
            
                "sale_next_number": 8,
            
        
    
        
        
            
                "invoice_footer_note": "Livraisons possibles a Dakar et environs.",
            
        
    
    },
    
    {
    
        
        
            
                "company_name": "YAYE MATY AGRO",
            
        
    
        
        
            
                "legal_name": "YAYE MATY AGRO SARL",
            
        
    
        
        
            
                "address": "Keur Massar, Dakar, Senegal",
            
        
    
        
        
            
                "phone": "+221770000000",
            
        
    
        
        
            
                "email": "support@yayematyagro.sn",
            
        
    
        
        
            
                "city": "Dakar",
            
        
    
        
        
            
                "country": "Senegal",
            
        
    
        
        
            
                "tax_id": "NINEA-YMA-123456",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "primary_color": "#A855F7",
            
        
    
        
        
            
                "secondary_color": "#0B1220",
            
        
    
        
        
            
                "theme": "dark",
            
        
    
        
        
            
                "invoice_prefix": "FAC",
            
        
    
        
        
            
                "quote_prefix": "DEV",
            
        
    
        
        
            
                "sale_prefix": "VEN",
            
        
    
        
        
            
                "invoice_next_number": 9,
            
        
    
        
        
            
                "quote_next_number": 9,
            
        
    
        
        
            
                "sale_next_number": 9,
            
        
    
        
        
            
                "invoice_footer_note": "Support: Lundi a Samedi 08h-18h.",
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                "logged_at": new Date('2026-06-04T12:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "CREATE_INVOICE",
            
        
    
        
        
            
                "entity": "invoices",
            
        
    
        
        
            
                "entity_key": "FAC-2026-0001",
            
        
    
        
        
            
                "level": "info",
            
        
    
        
        
            
                "ip_address": "197.149.201.10",
            
        
    
        
        
            
                "user_agent": "Chrome",
            
        
    
        
        
            
                "details": "Facture creee pour Boutique Bio Almadies.",
            
        
    
    },
    
    {
    
        
        
            
                "logged_at": new Date('2026-06-04T12:12:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "RECORD_PAYMENT",
            
        
    
        
        
            
                "entity": "payments",
            
        
    
        
        
            
                "entity_key": "PAY-2026-0001",
            
        
    
        
        
            
                "level": "error",
            
        
    
        
        
            
                "ip_address": "197.149.201.10",
            
        
    
        
        
            
                "user_agent": "Chrome",
            
        
    
        
        
            
                "details": "Paiement Wave enregistre sur FAC-2026-0001.",
            
        
    
    },
    
    {
    
        
        
            
                "logged_at": new Date('2026-06-06T08:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "CONFIRM_SALE",
            
        
    
        
        
            
                "entity": "sales",
            
        
    
        
        
            
                "entity_key": "VEN-2026-0002",
            
        
    
        
        
            
                "level": "warning",
            
        
    
        
        
            
                "ip_address": "197.149.201.21",
            
        
    
        
        
            
                "user_agent": "Firefox",
            
        
    
        
        
            
                "details": "Vente confirme et livree.",
            
        
    
    },
    
    {
    
        
        
            
                "logged_at": new Date('2026-06-08T16:50:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "ADJUST_STOCK",
            
        
    
        
        
            
                "entity": "stock_movements",
            
        
    
        
        
            
                "entity_key": "SM-2026-0005",
            
        
    
        
        
            
                "level": "warning",
            
        
    
        
        
            
                "ip_address": "197.149.201.33",
            
        
    
        
        
            
                "user_agent": "Chrome",
            
        
    
        
        
            
                "details": "Ajustement stock pour sachet endommage.",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

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

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateCategoryWithParent() {
            
                const relatedParent0 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category0 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Category0?.setParent)
                {
                    await
                    Category0.
                    setParent(relatedParent0);
                }
            
                const relatedParent1 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category1 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Category1?.setParent)
                {
                    await
                    Category1.
                    setParent(relatedParent1);
                }
            
                const relatedParent2 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category2 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Category2?.setParent)
                {
                    await
                    Category2.
                    setParent(relatedParent2);
                }
            
                const relatedParent3 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Category3 = await Categories.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Category3?.setParent)
                {
                    await
                    Category3.
                    setParent(relatedParent3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateProductWithCategory() {
            
                const relatedCategory0 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setCategory)
                {
                    await
                    Product0.
                    setCategory(relatedCategory0);
                }
            
                const relatedCategory1 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setCategory)
                {
                    await
                    Product1.
                    setCategory(relatedCategory1);
                }
            
                const relatedCategory2 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setCategory)
                {
                    await
                    Product2.
                    setCategory(relatedCategory2);
                }
            
                const relatedCategory3 = await Categories.findOne({
                    offset: Math.floor(Math.random() * (await Categories.count())),
                });
                const Product3 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Product3?.setCategory)
                {
                    await
                    Product3.
                    setCategory(relatedCategory3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateStockMovementWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setProduct)
                {
                    await
                    StockMovement0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setProduct)
                {
                    await
                    StockMovement1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setProduct)
                {
                    await
                    StockMovement2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const StockMovement3 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StockMovement3?.setProduct)
                {
                    await
                    StockMovement3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateStockMovementWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setSupplier)
                {
                    await
                    StockMovement0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setSupplier)
                {
                    await
                    StockMovement1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setSupplier)
                {
                    await
                    StockMovement2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const StockMovement3 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StockMovement3?.setSupplier)
                {
                    await
                    StockMovement3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
            
            async function associateStockMovementWithClient() {
            
                const relatedClient0 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setClient)
                {
                    await
                    StockMovement0.
                    setClient(relatedClient0);
                }
            
                const relatedClient1 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setClient)
                {
                    await
                    StockMovement1.
                    setClient(relatedClient1);
                }
            
                const relatedClient2 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setClient)
                {
                    await
                    StockMovement2.
                    setClient(relatedClient2);
                }
            
                const relatedClient3 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const StockMovement3 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StockMovement3?.setClient)
                {
                    await
                    StockMovement3.
                    setClient(relatedClient3);
                }
            
        }
        
    
        
            
            async function associateStockMovementWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StockMovement0 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StockMovement0?.setUser)
                {
                    await
                    StockMovement0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StockMovement1 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StockMovement1?.setUser)
                {
                    await
                    StockMovement1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StockMovement2 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StockMovement2?.setUser)
                {
                    await
                    StockMovement2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StockMovement3 = await StockMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StockMovement3?.setUser)
                {
                    await
                    StockMovement3.
                    setUser(relatedUser3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateQuoteWithClient() {
            
                const relatedClient0 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Quote0 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quote0?.setClient)
                {
                    await
                    Quote0.
                    setClient(relatedClient0);
                }
            
                const relatedClient1 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Quote1 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quote1?.setClient)
                {
                    await
                    Quote1.
                    setClient(relatedClient1);
                }
            
                const relatedClient2 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Quote2 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quote2?.setClient)
                {
                    await
                    Quote2.
                    setClient(relatedClient2);
                }
            
                const relatedClient3 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Quote3 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Quote3?.setClient)
                {
                    await
                    Quote3.
                    setClient(relatedClient3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateQuoteWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Quote0 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quote0?.setCreated_by_user)
                {
                    await
                    Quote0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Quote1 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quote1?.setCreated_by_user)
                {
                    await
                    Quote1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Quote2 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quote2?.setCreated_by_user)
                {
                    await
                    Quote2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Quote3 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Quote3?.setCreated_by_user)
                {
                    await
                    Quote3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateQuoteItemWithQuote() {
            
                const relatedQuote0 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteItem0 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuoteItem0?.setQuote)
                {
                    await
                    QuoteItem0.
                    setQuote(relatedQuote0);
                }
            
                const relatedQuote1 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteItem1 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuoteItem1?.setQuote)
                {
                    await
                    QuoteItem1.
                    setQuote(relatedQuote1);
                }
            
                const relatedQuote2 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteItem2 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuoteItem2?.setQuote)
                {
                    await
                    QuoteItem2.
                    setQuote(relatedQuote2);
                }
            
                const relatedQuote3 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteItem3 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QuoteItem3?.setQuote)
                {
                    await
                    QuoteItem3.
                    setQuote(relatedQuote3);
                }
            
        }
        
    
        
            
            async function associateQuoteItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteItem0 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuoteItem0?.setProduct)
                {
                    await
                    QuoteItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteItem1 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuoteItem1?.setProduct)
                {
                    await
                    QuoteItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteItem2 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuoteItem2?.setProduct)
                {
                    await
                    QuoteItem2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteItem3 = await QuoteItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QuoteItem3?.setProduct)
                {
                    await
                    QuoteItem3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateSaleWithClient() {
            
                const relatedClient0 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Sale0 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Sale0?.setClient)
                {
                    await
                    Sale0.
                    setClient(relatedClient0);
                }
            
                const relatedClient1 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Sale1 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Sale1?.setClient)
                {
                    await
                    Sale1.
                    setClient(relatedClient1);
                }
            
                const relatedClient2 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Sale2 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Sale2?.setClient)
                {
                    await
                    Sale2.
                    setClient(relatedClient2);
                }
            
                const relatedClient3 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Sale3 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Sale3?.setClient)
                {
                    await
                    Sale3.
                    setClient(relatedClient3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSaleWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Sale0 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Sale0?.setCreated_by_user)
                {
                    await
                    Sale0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Sale1 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Sale1?.setCreated_by_user)
                {
                    await
                    Sale1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Sale2 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Sale2?.setCreated_by_user)
                {
                    await
                    Sale2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Sale3 = await Sales.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Sale3?.setCreated_by_user)
                {
                    await
                    Sale3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSaleItemWithSale() {
            
                const relatedSale0 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const SaleItem0 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SaleItem0?.setSale)
                {
                    await
                    SaleItem0.
                    setSale(relatedSale0);
                }
            
                const relatedSale1 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const SaleItem1 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SaleItem1?.setSale)
                {
                    await
                    SaleItem1.
                    setSale(relatedSale1);
                }
            
                const relatedSale2 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const SaleItem2 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SaleItem2?.setSale)
                {
                    await
                    SaleItem2.
                    setSale(relatedSale2);
                }
            
                const relatedSale3 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const SaleItem3 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SaleItem3?.setSale)
                {
                    await
                    SaleItem3.
                    setSale(relatedSale3);
                }
            
        }
        
    
        
            
            async function associateSaleItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SaleItem0 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SaleItem0?.setProduct)
                {
                    await
                    SaleItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SaleItem1 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SaleItem1?.setProduct)
                {
                    await
                    SaleItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SaleItem2 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SaleItem2?.setProduct)
                {
                    await
                    SaleItem2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const SaleItem3 = await SaleItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SaleItem3?.setProduct)
                {
                    await
                    SaleItem3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateInvoiceWithClient() {
            
                const relatedClient0 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setClient)
                {
                    await
                    Invoice0.
                    setClient(relatedClient0);
                }
            
                const relatedClient1 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setClient)
                {
                    await
                    Invoice1.
                    setClient(relatedClient1);
                }
            
                const relatedClient2 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setClient)
                {
                    await
                    Invoice2.
                    setClient(relatedClient2);
                }
            
                const relatedClient3 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setClient)
                {
                    await
                    Invoice3.
                    setClient(relatedClient3);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithQuote() {
            
                const relatedQuote0 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setQuote)
                {
                    await
                    Invoice0.
                    setQuote(relatedQuote0);
                }
            
                const relatedQuote1 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setQuote)
                {
                    await
                    Invoice1.
                    setQuote(relatedQuote1);
                }
            
                const relatedQuote2 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setQuote)
                {
                    await
                    Invoice2.
                    setQuote(relatedQuote2);
                }
            
                const relatedQuote3 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setQuote)
                {
                    await
                    Invoice3.
                    setQuote(relatedQuote3);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithSale() {
            
                const relatedSale0 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setSale)
                {
                    await
                    Invoice0.
                    setSale(relatedSale0);
                }
            
                const relatedSale1 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setSale)
                {
                    await
                    Invoice1.
                    setSale(relatedSale1);
                }
            
                const relatedSale2 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setSale)
                {
                    await
                    Invoice2.
                    setSale(relatedSale2);
                }
            
                const relatedSale3 = await Sales.findOne({
                    offset: Math.floor(Math.random() * (await Sales.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setSale)
                {
                    await
                    Invoice3.
                    setSale(relatedSale3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCreated_by_user)
                {
                    await
                    Invoice0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCreated_by_user)
                {
                    await
                    Invoice1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCreated_by_user)
                {
                    await
                    Invoice2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setCreated_by_user)
                {
                    await
                    Invoice3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceItemWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceItem0 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceItem0?.setInvoice)
                {
                    await
                    InvoiceItem0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceItem1 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceItem1?.setInvoice)
                {
                    await
                    InvoiceItem1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceItem2 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceItem2?.setInvoice)
                {
                    await
                    InvoiceItem2.
                    setInvoice(relatedInvoice2);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceItem3 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InvoiceItem3?.setInvoice)
                {
                    await
                    InvoiceItem3.
                    setInvoice(relatedInvoice3);
                }
            
        }
        
    
        
            
            async function associateInvoiceItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceItem0 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceItem0?.setProduct)
                {
                    await
                    InvoiceItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceItem1 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceItem1?.setProduct)
                {
                    await
                    InvoiceItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceItem2 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceItem2?.setProduct)
                {
                    await
                    InvoiceItem2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceItem3 = await InvoiceItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InvoiceItem3?.setProduct)
                {
                    await
                    InvoiceItem3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            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);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setInvoice)
                {
                    await
                    Payment3.
                    setInvoice(relatedInvoice3);
                }
            
        }
        
    
        
            
            async function associatePaymentWithClient() {
            
                const relatedClient0 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setClient)
                {
                    await
                    Payment0.
                    setClient(relatedClient0);
                }
            
                const relatedClient1 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setClient)
                {
                    await
                    Payment1.
                    setClient(relatedClient1);
                }
            
                const relatedClient2 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setClient)
                {
                    await
                    Payment2.
                    setClient(relatedClient2);
                }
            
                const relatedClient3 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setClient)
                {
                    await
                    Payment3.
                    setClient(relatedClient3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithReceived_by_user() {
            
                const relatedReceived_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setReceived_by_user)
                {
                    await
                    Payment0.
                    setReceived_by_user(relatedReceived_by_user0);
                }
            
                const relatedReceived_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setReceived_by_user)
                {
                    await
                    Payment1.
                    setReceived_by_user(relatedReceived_by_user1);
                }
            
                const relatedReceived_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setReceived_by_user)
                {
                    await
                    Payment2.
                    setReceived_by_user(relatedReceived_by_user2);
                }
            
                const relatedReceived_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setReceived_by_user)
                {
                    await
                    Payment3.
                    setReceived_by_user(relatedReceived_by_user3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateExpensWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Expens0 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Expens0?.setSupplier)
                {
                    await
                    Expens0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Expens1 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Expens1?.setSupplier)
                {
                    await
                    Expens1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Expens2 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Expens2?.setSupplier)
                {
                    await
                    Expens2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Expens3 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Expens3?.setSupplier)
                {
                    await
                    Expens3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateExpensWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Expens0 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Expens0?.setCreated_by_user)
                {
                    await
                    Expens0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Expens1 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Expens1?.setCreated_by_user)
                {
                    await
                    Expens1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Expens2 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Expens2?.setCreated_by_user)
                {
                    await
                    Expens2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Expens3 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Expens3?.setCreated_by_user)
                {
                    await
                    Expens3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCashMovementWithPayment() {
            
                const relatedPayment0 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const CashMovement0 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CashMovement0?.setPayment)
                {
                    await
                    CashMovement0.
                    setPayment(relatedPayment0);
                }
            
                const relatedPayment1 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const CashMovement1 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CashMovement1?.setPayment)
                {
                    await
                    CashMovement1.
                    setPayment(relatedPayment1);
                }
            
                const relatedPayment2 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const CashMovement2 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CashMovement2?.setPayment)
                {
                    await
                    CashMovement2.
                    setPayment(relatedPayment2);
                }
            
                const relatedPayment3 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const CashMovement3 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CashMovement3?.setPayment)
                {
                    await
                    CashMovement3.
                    setPayment(relatedPayment3);
                }
            
        }
        
    
        
            
            async function associateCashMovementWithExpense() {
            
                const relatedExpense0 = await Expenses.findOne({
                    offset: Math.floor(Math.random() * (await Expenses.count())),
                });
                const CashMovement0 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CashMovement0?.setExpense)
                {
                    await
                    CashMovement0.
                    setExpense(relatedExpense0);
                }
            
                const relatedExpense1 = await Expenses.findOne({
                    offset: Math.floor(Math.random() * (await Expenses.count())),
                });
                const CashMovement1 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CashMovement1?.setExpense)
                {
                    await
                    CashMovement1.
                    setExpense(relatedExpense1);
                }
            
                const relatedExpense2 = await Expenses.findOne({
                    offset: Math.floor(Math.random() * (await Expenses.count())),
                });
                const CashMovement2 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CashMovement2?.setExpense)
                {
                    await
                    CashMovement2.
                    setExpense(relatedExpense2);
                }
            
                const relatedExpense3 = await Expenses.findOne({
                    offset: Math.floor(Math.random() * (await Expenses.count())),
                });
                const CashMovement3 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CashMovement3?.setExpense)
                {
                    await
                    CashMovement3.
                    setExpense(relatedExpense3);
                }
            
        }
        
    
        
    
        
            
            async function associateCashMovementWithRecorded_by_user() {
            
                const relatedRecorded_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CashMovement0 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CashMovement0?.setRecorded_by_user)
                {
                    await
                    CashMovement0.
                    setRecorded_by_user(relatedRecorded_by_user0);
                }
            
                const relatedRecorded_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CashMovement1 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CashMovement1?.setRecorded_by_user)
                {
                    await
                    CashMovement1.
                    setRecorded_by_user(relatedRecorded_by_user1);
                }
            
                const relatedRecorded_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CashMovement2 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CashMovement2?.setRecorded_by_user)
                {
                    await
                    CashMovement2.
                    setRecorded_by_user(relatedRecorded_by_user2);
                }
            
                const relatedRecorded_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CashMovement3 = await CashMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CashMovement3?.setRecorded_by_user)
                {
                    await
                    CashMovement3.
                    setRecorded_by_user(relatedRecorded_by_user3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePoultryLotWithManager_user() {
            
                const relatedManager_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PoultryLot0 = await PoultryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PoultryLot0?.setManager_user)
                {
                    await
                    PoultryLot0.
                    setManager_user(relatedManager_user0);
                }
            
                const relatedManager_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PoultryLot1 = await PoultryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PoultryLot1?.setManager_user)
                {
                    await
                    PoultryLot1.
                    setManager_user(relatedManager_user1);
                }
            
                const relatedManager_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PoultryLot2 = await PoultryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PoultryLot2?.setManager_user)
                {
                    await
                    PoultryLot2.
                    setManager_user(relatedManager_user2);
                }
            
                const relatedManager_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PoultryLot3 = await PoultryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PoultryLot3?.setManager_user)
                {
                    await
                    PoultryLot3.
                    setManager_user(relatedManager_user3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEggCollectionWithPoultry_lot() {
            
                const relatedPoultry_lot0 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const EggCollection0 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EggCollection0?.setPoultry_lot)
                {
                    await
                    EggCollection0.
                    setPoultry_lot(relatedPoultry_lot0);
                }
            
                const relatedPoultry_lot1 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const EggCollection1 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EggCollection1?.setPoultry_lot)
                {
                    await
                    EggCollection1.
                    setPoultry_lot(relatedPoultry_lot1);
                }
            
                const relatedPoultry_lot2 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const EggCollection2 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EggCollection2?.setPoultry_lot)
                {
                    await
                    EggCollection2.
                    setPoultry_lot(relatedPoultry_lot2);
                }
            
                const relatedPoultry_lot3 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const EggCollection3 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EggCollection3?.setPoultry_lot)
                {
                    await
                    EggCollection3.
                    setPoultry_lot(relatedPoultry_lot3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEggCollectionWithRecorded_by_user() {
            
                const relatedRecorded_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EggCollection0 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EggCollection0?.setRecorded_by_user)
                {
                    await
                    EggCollection0.
                    setRecorded_by_user(relatedRecorded_by_user0);
                }
            
                const relatedRecorded_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EggCollection1 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EggCollection1?.setRecorded_by_user)
                {
                    await
                    EggCollection1.
                    setRecorded_by_user(relatedRecorded_by_user1);
                }
            
                const relatedRecorded_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EggCollection2 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EggCollection2?.setRecorded_by_user)
                {
                    await
                    EggCollection2.
                    setRecorded_by_user(relatedRecorded_by_user2);
                }
            
                const relatedRecorded_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const EggCollection3 = await EggCollections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EggCollection3?.setRecorded_by_user)
                {
                    await
                    EggCollection3.
                    setRecorded_by_user(relatedRecorded_by_user3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTreatmentWithPoultry_lot() {
            
                const relatedPoultry_lot0 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Treatment0 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Treatment0?.setPoultry_lot)
                {
                    await
                    Treatment0.
                    setPoultry_lot(relatedPoultry_lot0);
                }
            
                const relatedPoultry_lot1 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Treatment1 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Treatment1?.setPoultry_lot)
                {
                    await
                    Treatment1.
                    setPoultry_lot(relatedPoultry_lot1);
                }
            
                const relatedPoultry_lot2 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Treatment2 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Treatment2?.setPoultry_lot)
                {
                    await
                    Treatment2.
                    setPoultry_lot(relatedPoultry_lot2);
                }
            
                const relatedPoultry_lot3 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Treatment3 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Treatment3?.setPoultry_lot)
                {
                    await
                    Treatment3.
                    setPoultry_lot(relatedPoultry_lot3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTreatmentWithPerformed_by_user() {
            
                const relatedPerformed_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Treatment0 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Treatment0?.setPerformed_by_user)
                {
                    await
                    Treatment0.
                    setPerformed_by_user(relatedPerformed_by_user0);
                }
            
                const relatedPerformed_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Treatment1 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Treatment1?.setPerformed_by_user)
                {
                    await
                    Treatment1.
                    setPerformed_by_user(relatedPerformed_by_user1);
                }
            
                const relatedPerformed_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Treatment2 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Treatment2?.setPerformed_by_user)
                {
                    await
                    Treatment2.
                    setPerformed_by_user(relatedPerformed_by_user2);
                }
            
                const relatedPerformed_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Treatment3 = await Treatments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Treatment3?.setPerformed_by_user)
                {
                    await
                    Treatment3.
                    setPerformed_by_user(relatedPerformed_by_user3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAlertWithClient() {
            
                const relatedClient0 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setClient)
                {
                    await
                    Alert0.
                    setClient(relatedClient0);
                }
            
                const relatedClient1 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setClient)
                {
                    await
                    Alert1.
                    setClient(relatedClient1);
                }
            
                const relatedClient2 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setClient)
                {
                    await
                    Alert2.
                    setClient(relatedClient2);
                }
            
                const relatedClient3 = await Clients.findOne({
                    offset: Math.floor(Math.random() * (await Clients.count())),
                });
                const Alert3 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Alert3?.setClient)
                {
                    await
                    Alert3.
                    setClient(relatedClient3);
                }
            
        }
        
    
        
            
            async function associateAlertWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setProduct)
                {
                    await
                    Alert0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setProduct)
                {
                    await
                    Alert1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setProduct)
                {
                    await
                    Alert2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const Alert3 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Alert3?.setProduct)
                {
                    await
                    Alert3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
            
            async function associateAlertWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setInvoice)
                {
                    await
                    Alert0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setInvoice)
                {
                    await
                    Alert1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setInvoice)
                {
                    await
                    Alert2.
                    setInvoice(relatedInvoice2);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Alert3 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Alert3?.setInvoice)
                {
                    await
                    Alert3.
                    setInvoice(relatedInvoice3);
                }
            
        }
        
    
        
            
            async function associateAlertWithPoultry_lot() {
            
                const relatedPoultry_lot0 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setPoultry_lot)
                {
                    await
                    Alert0.
                    setPoultry_lot(relatedPoultry_lot0);
                }
            
                const relatedPoultry_lot1 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setPoultry_lot)
                {
                    await
                    Alert1.
                    setPoultry_lot(relatedPoultry_lot1);
                }
            
                const relatedPoultry_lot2 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setPoultry_lot)
                {
                    await
                    Alert2.
                    setPoultry_lot(relatedPoultry_lot2);
                }
            
                const relatedPoultry_lot3 = await PoultryLots.findOne({
                    offset: Math.floor(Math.random() * (await PoultryLots.count())),
                });
                const Alert3 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Alert3?.setPoultry_lot)
                {
                    await
                    Alert3.
                    setPoultry_lot(relatedPoultry_lot3);
                }
            
        }
        
    
        
            
            async function associateAlertWithAssigned_to_user() {
            
                const relatedAssigned_to_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setAssigned_to_user)
                {
                    await
                    Alert0.
                    setAssigned_to_user(relatedAssigned_to_user0);
                }
            
                const relatedAssigned_to_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setAssigned_to_user)
                {
                    await
                    Alert1.
                    setAssigned_to_user(relatedAssigned_to_user1);
                }
            
                const relatedAssigned_to_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setAssigned_to_user)
                {
                    await
                    Alert2.
                    setAssigned_to_user(relatedAssigned_to_user2);
                }
            
                const relatedAssigned_to_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert3 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Alert3?.setAssigned_to_user)
                {
                    await
                    Alert3.
                    setAssigned_to_user(relatedAssigned_to_user3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateAuditLogWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setUser)
                {
                    await
                    AuditLog0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setUser)
                {
                    await
                    AuditLog1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setUser)
                {
                    await
                    AuditLog2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setUser)
                {
                    await
                    AuditLog3.
                    setUser(relatedUser3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await RolePermissions.bulkCreate(RolePermissionsData);
                
            
            
                
                await Clients.bulkCreate(ClientsData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Categories.bulkCreate(CategoriesData);
                
            
            
                
                await Products.bulkCreate(ProductsData);
                
            
            
                
                await StockMovements.bulkCreate(StockMovementsData);
                
            
            
                
                await Quotes.bulkCreate(QuotesData);
                
            
            
                
                await QuoteItems.bulkCreate(QuoteItemsData);
                
            
            
                
                await Sales.bulkCreate(SalesData);
                
            
            
                
                await SaleItems.bulkCreate(SaleItemsData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await InvoiceItems.bulkCreate(InvoiceItemsData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await Expenses.bulkCreate(ExpensesData);
                
            
            
                
                await CashMovements.bulkCreate(CashMovementsData);
                
            
            
                
                await PoultryLots.bulkCreate(PoultryLotsData);
                
            
            
                
                await EggCollections.bulkCreate(EggCollectionsData);
                
            
            
                
                await Treatments.bulkCreate(TreatmentsData);
                
            
            
                
                await Alerts.bulkCreate(AlertsData);
                
            
            
                
                await Settings.bulkCreate(SettingsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                        
                        await associateRolePermissionWithPermission(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateCategoryWithParent(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateProductWithCategory(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateStockMovementWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateStockMovementWithSupplier(),
                    
                
                    
                        
                        await associateStockMovementWithClient(),
                    
                
                    
                        
                        await associateStockMovementWithUser(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateQuoteWithClient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQuoteWithCreated_by_user(),
                    
                
            
                
                
                    
                        
                        await associateQuoteItemWithQuote(),
                    
                
                    
                        
                        await associateQuoteItemWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateSaleWithClient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSaleWithCreated_by_user(),
                    
                
            
                
                
                    
                        
                        await associateSaleItemWithSale(),
                    
                
                    
                        
                        await associateSaleItemWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateInvoiceWithClient(),
                    
                
                    
                        
                        await associateInvoiceWithQuote(),
                    
                
                    
                        
                        await associateInvoiceWithSale(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceWithCreated_by_user(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceItemWithInvoice(),
                    
                
                    
                        
                        await associateInvoiceItemWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                        
                        await associatePaymentWithClient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithReceived_by_user(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateExpensWithSupplier(),
                    
                
                    
                
                    
                
                    
                        
                        await associateExpensWithCreated_by_user(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCashMovementWithPayment(),
                    
                
                    
                        
                        await associateCashMovementWithExpense(),
                    
                
                    
                
                    
                        
                        await associateCashMovementWithRecorded_by_user(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePoultryLotWithManager_user(),
                    
                
            
                
                
                    
                        
                        await associateEggCollectionWithPoultry_lot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEggCollectionWithRecorded_by_user(),
                    
                
            
                
                
                    
                        
                        await associateTreatmentWithPoultry_lot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTreatmentWithPerformed_by_user(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAlertWithClient(),
                    
                
                    
                        
                        await associateAlertWithProduct(),
                    
                
                    
                        
                        await associateAlertWithInvoice(),
                    
                
                    
                        
                        await associateAlertWithPoultry_lot(),
                    
                
                    
                        
                        await associateAlertWithAssigned_to_user(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateAuditLogWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('role_permissions', null, {});
            
            
            await queryInterface.bulkDelete('clients', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('categories', null, {});
            
            
            await queryInterface.bulkDelete('products', null, {});
            
            
            await queryInterface.bulkDelete('stock_movements', null, {});
            
            
            await queryInterface.bulkDelete('quotes', null, {});
            
            
            await queryInterface.bulkDelete('quote_items', null, {});
            
            
            await queryInterface.bulkDelete('sales', null, {});
            
            
            await queryInterface.bulkDelete('sale_items', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('invoice_items', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('expenses', null, {});
            
            
            await queryInterface.bulkDelete('cash_movements', null, {});
            
            
            await queryInterface.bulkDelete('poultry_lots', null, {});
            
            
            await queryInterface.bulkDelete('egg_collections', null, {});
            
            
            await queryInterface.bulkDelete('treatments', null, {});
            
            
            await queryInterface.bulkDelete('alerts', null, {});
            
            
            await queryInterface.bulkDelete('settings', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
        
    },
};