const db = require('../models'); const Users = db.users; const PracticeGroups = db.practice_groups; const MatterTypes = db.matter_types; const DataClassifications = db.data_classifications; const AiTools = db.ai_tools; const Vendors = db.vendors; const AiUseCases = db.ai_use_cases; const ApprovalSteps = db.approval_steps; const VendorRiskAssessments = db.vendor_risk_assessments; const Policies = db.policies; const HumanReviewChecklists = db.human_review_checklists; const ChecklistItems = db.checklist_items; const TrainingCourses = db.training_courses; const TrainingRequirements = db.training_requirements; const UserTrainingRecords = db.user_training_records; const ToolEntitlements = db.tool_entitlements; const WorkflowRuns = db.workflow_runs; const ReviewExceptions = db.review_exceptions; const Integrations = db.integrations; const RolesCatalog = db.roles_catalog; const PracticeGroupsData = [ { "name": "Litigation", "description": "Commercial litigation and dispute resolution practice.", // type code here for "relation_one" field "is_active": true, }, { "name": "Corporate", "description": "Mergers, acquisitions, and general corporate counseling.", // type code here for "relation_one" field "is_active": true, }, { "name": "Privacy and Cybersecurity", "description": "Privacy compliance, incident response, and cybersecurity counseling.", // type code here for "relation_one" field "is_active": true, }, { "name": "Employment", "description": "Employment advice, investigations, and workplace litigation.", // type code here for "relation_one" field "is_active": true, }, { "name": "Real Estate", "description": "Commercial leasing, acquisitions, and development matters.", // type code here for "relation_one" field "is_active": true, }, ]; const MatterTypesData = [ { "name": "Commercial Litigation", "description": "Business disputes, motions, discovery, and trial support.", "is_active": true, }, { "name": "Mergers and Acquisitions", "description": "Buy-side and sell-side transactions and diligence.", "is_active": true, }, { "name": "Privacy Compliance", "description": "Privacy program development and regulatory compliance.", "is_active": true, }, { "name": "Employment Advice", "description": "Policies, investigations, and counseling.", "is_active": true, }, { "name": "Contracting", "description": "Contract drafting, negotiation, and review.", "is_active": true, }, ]; const DataClassificationsData = [ { "label": "Public Information", "level": "internal", "restrictions": "No confidential or client data. Public sources only.", "risk_notes": "Low risk when used with approved tools.", "required_human_review_level": "none", "requires_client_notice": false, }, { "label": "Internal Work Product", "level": "privileged", "restrictions": "Internal operational content only. No client identifiers.", "risk_notes": "Confirm tool retention and access controls.", "required_human_review_level": "peer_review", "requires_client_notice": true, }, { "label": "Confidential Firm Data", "level": "privileged", "restrictions": "Firm confidential data allowed only in approved enterprise tools.", "risk_notes": "Ensure encryption, retention limits, and audit logging.", "required_human_review_level": "supervisor_review", "requires_client_notice": true, }, { "label": "Privileged Client Material", "level": "internal", "restrictions": "Privileged material only with explicit approval and human review.", "risk_notes": "Heightened privilege risk. Use minimal necessary data.", "required_human_review_level": "none", "requires_client_notice": true, }, { "label": "Regulated Data", "level": "internal", "restrictions": "Regulated data requires data residency controls and DPA review.", "risk_notes": "Verify compliance controls and deletion SLAs.", "required_human_review_level": "peer_review", "requires_client_notice": true, }, ]; const AiToolsData = [ { "name": "ChatGPT Enterprise", "tool_type": "drafting", // type code here for "relation_one" field "deployment_model": "on_prem", "approval_status": "proposed", "supports_sso": true, "supports_audit_logs": true, "soc2_status": "type_ii", "data_retention_policy": "configurable", "training_on_client_data_policy": "no", "data_residency": "eu", "deletion_policy": "within_30_days", "security_posture_summary": "Enterprise controls with SSO and admin audit logs; retention configurable per contract.", // type code here for "files" field "monthly_cost": 2400.0, "subprocessors": "Vendor-provided subprocessors list to be reviewed in DPA.", "notes": "Pilot for internal drafting and summarization with strict guardrails.", }, { "name": "Claude Team", "tool_type": "ediscovery", // type code here for "relation_one" field "deployment_model": "hybrid", "approval_status": "proposed", "supports_sso": true, "supports_audit_logs": true, "soc2_status": "type_ii", "data_retention_policy": "unknown", "training_on_client_data_policy": "no", "data_residency": "configurable", "deletion_policy": "within_30_days", "security_posture_summary": "Team plan with workspace controls; confirm retention and export capabilities.", // type code here for "files" field "monthly_cost": 1200.0, "subprocessors": "Subprocessors subject to vendor transparency report.", "notes": "Evaluate for redlining assistance and summaries without client identifiers.", }, { "name": "Gemini for Workspace", "tool_type": "internal_llm", // type code here for "relation_one" field "deployment_model": "saas", "approval_status": "proposed", "supports_sso": true, "supports_audit_logs": true, "soc2_status": "in_progress", "data_retention_policy": "unknown", "training_on_client_data_policy": "no", "data_residency": "eu", "deletion_policy": "unknown", "security_posture_summary": "Workspace integrated. Confirm logging scope and data boundaries.", // type code here for "files" field "monthly_cost": 1800.0, "subprocessors": "Google Cloud subprocessors per public list.", "notes": "Consider for email drafting with internal-only constraints.", }, { "name": "Lexis AI Research", "tool_type": "llm_chat", // type code here for "relation_one" field "deployment_model": "private_cloud", "approval_status": "in_review", "supports_sso": true, "supports_audit_logs": true, "soc2_status": "type_ii", "data_retention_policy": "configurable", "training_on_client_data_policy": "opt_in", "data_residency": "us", "deletion_policy": "immediate", "security_posture_summary": "Legal research platform with enterprise access controls.", // type code here for "files" field "monthly_cost": 9500.0, "subprocessors": "As disclosed in vendor security package.", "notes": "Approved for research with citation verification and human review.", }, { "name": "Relativity AI", "tool_type": "internal_llm", // type code here for "relation_one" field "deployment_model": "on_prem", "approval_status": "restricted", "supports_sso": true, "supports_audit_logs": true, "soc2_status": "type_ii", "data_retention_policy": "unknown", "training_on_client_data_policy": "no", "data_residency": "global", "deletion_policy": "within_30_days", "security_posture_summary": "E-discovery environment with strong RBAC and audit logs.", // type code here for "files" field "monthly_cost": 15000.0, "subprocessors": "Per Relativity trust documentation.", "notes": "Approved for discovery workflows under litigation protocols.", }, ]; const VendorsData = [ { "name": "OpenAI", "website": "https://openai.com", "vendor_status": "retired", "primary_contact_name": "Taylor Brooks", "primary_contact_email": "taylor.brooks@openai.example", // type code here for "files" field "notes": "Evaluate enterprise terms, retention options, and audit logging.", }, { "name": "Anthropic", "website": "https://www.anthropic.com", "vendor_status": "suspended", "primary_contact_name": "Sam Rivera", "primary_contact_email": "sam.rivera@anthropic.example", // type code here for "files" field "notes": "Review data use policy and SOC2 documentation.", }, { "name": "Google Cloud", "website": "https://cloud.google.com", "vendor_status": "in_review", "primary_contact_name": "Jamie Park", "primary_contact_email": "jamie.park@google.example", // type code here for "files" field "notes": "Assess Gemini enterprise controls and data residency options.", }, { "name": "LexisNexis", "website": "https://www.lexisnexis.com", "vendor_status": "retired", "primary_contact_name": "Robin Shaw", "primary_contact_email": "robin.shaw@lexisnexis.example", // type code here for "files" field "notes": "Legal research platform. Confirm AI feature guardrails.", }, { "name": "Relativity", "website": "https://www.relativity.com", "vendor_status": "suspended", "primary_contact_name": "Drew Harris", "primary_contact_email": "drew.harris@relativity.example", // type code here for "files" field "notes": "E-discovery platform. Review audit logging and admin controls.", }, ]; const AiUseCasesData = [ { "title": "Deposition summary drafting", "description": "Generate an initial deposition summary outline and key themes for attorney review.", // 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 "business_goal": "Reduce time to produce first draft summaries while maintaining accuracy through review.", "status": "retired", "risk_level": "critical", "expected_hours_saved": 12.5, "review_notes": "Limit to redacted excerpts and ensure final summary is attorney authored.", "submitted_at": new Date('2026-04-22T15:00:00Z'), "approved_at": new Date('2026-05-05T17:30:00Z'), }, { "title": "Contract clause comparison assistant", "description": "Compare vendor contract clauses against standard playbook language and flag deviations.", // 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 "business_goal": "Speed up contract review and reduce missed deviations.", "status": "approved", "risk_level": "critical", "expected_hours_saved": 8.0, "review_notes": "Do not input client names. Use clause-only text where possible.", "submitted_at": new Date('2026-04-25T10:20:00Z'), "approved_at": new Date('2026-05-02T13:10:00Z'), }, { "title": "Client intake triage summary", "description": "Summarize intake notes into structured fields for conflict and routing.", // 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 "business_goal": "Improve intake turnaround time and standardize summaries.", "status": "risk_review", "risk_level": "high", "expected_hours_saved": 4.0, "review_notes": "No sensitive identifiers beyond internal ticket number.", "submitted_at": new Date('2026-05-01T09:45:00Z'), "approved_at": new Date('2026-05-09T12:00:00Z'), }, { "title": "Legal research memo outline", "description": "Create a memo outline with issues and candidate authorities for attorney verification.", // 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 "business_goal": "Accelerate research planning while preserving attorney judgment.", "status": "risk_review", "risk_level": "medium", "expected_hours_saved": 6.0, "review_notes": "Citations must be verified in primary sources before use.", "submitted_at": new Date('2026-03-18T14:10:00Z'), "approved_at": new Date('2026-03-28T16:00:00Z'), }, { "title": "Billing narrative generator", "description": "Draft time entry narratives from task codes and non-sensitive notes.", // 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 "business_goal": "Reduce administrative time and improve narrative consistency.", "status": "security_review", "risk_level": "critical", "expected_hours_saved": 3.5, "review_notes": "Ensure no privileged details. Require attorney review before submission.", "submitted_at": new Date('2026-04-30T18:05:00Z'), "approved_at": new Date('2026-05-07T11:15:00Z'), }, ]; const ApprovalStepsData = [ { // type code here for "relation_one" field "step_type": "general_counsel", // type code here for "relation_one" field "decision": "rejected", "comments": "SSO and audit logs confirmed for enterprise workspace. Require retention set to minimum.", "assigned_at": new Date('2026-04-22T16:00:00Z'), "decided_at": new Date('2026-04-24T13:30:00Z'), "step_order": 2, }, { // type code here for "relation_one" field "step_type": "it_security", // type code here for "relation_one" field "decision": "pending", "comments": "Require redaction guidance and mandatory checklist before client delivery.", "assigned_at": new Date('2026-04-24T14:00:00Z'), "decided_at": new Date('2026-04-26T10:10:00Z'), "step_order": 3, }, { // type code here for "relation_one" field "step_type": "general_counsel", // type code here for "relation_one" field "decision": "needs_changes", "comments": "Approve clause-only usage with no client identifiers and a documented review process.", "assigned_at": new Date('2026-04-25T12:00:00Z'), "decided_at": new Date('2026-04-27T09:20:00Z'), "step_order": 2, }, { // type code here for "relation_one" field "step_type": "partner", // type code here for "relation_one" field "decision": "approved", "comments": "Approved for outline generation. Verify all authorities before reliance.", "assigned_at": new Date('2026-03-18T15:00:00Z'), "decided_at": new Date('2026-03-20T08:40:00Z'), "step_order": 1, }, { // type code here for "relation_one" field "step_type": "partner", // type code here for "relation_one" field "decision": "needs_changes", "comments": "Add forbidden content examples and require review prior to invoice submission.", "assigned_at": new Date('2026-05-01T10:00:00Z'), "decided_at": new Date('2026-05-02T16:05:00Z'), "step_order": 3, }, ]; const VendorRiskAssessmentsData = [ { // type code here for "relation_one" field // type code here for "relation_one" field "assessment_status": "approved", "confidentiality_score": 4, "security_score": 4, "integration_readiness_score": 4, "legal_specific_risk_score": 3, "pricing_score": 3, "support_score": 4, "compliance_score": 4, "overall_score": 26, "findings": "Strong enterprise controls; confirm retention and export settings align with policy.", "mitigations": "Set minimum retention, enable SSO, restrict tool entitlements to trained users.", // type code here for "files" field // type code here for "relation_one" field "started_at": new Date('2026-04-10T09:00:00Z'), "completed_at": new Date('2026-04-28T17:00:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field "assessment_status": "approved", "confidentiality_score": 4, "security_score": 4, "integration_readiness_score": 3, "legal_specific_risk_score": 3, "pricing_score": 4, "support_score": 3, "compliance_score": 4, "overall_score": 25, "findings": "Security posture appears solid; confirm admin auditing and DPA terms.", "mitigations": "Run pilot with internal-only data and require checklist for client-facing output.", // type code here for "files" field // type code here for "relation_one" field "started_at": new Date('2026-04-20T10:00:00Z'), "completed_at": new Date('2026-05-10T12:00:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field "assessment_status": "needs_changes", "confidentiality_score": 4, "security_score": 4, "integration_readiness_score": 5, "legal_specific_risk_score": 3, "pricing_score": 3, "support_score": 4, "compliance_score": 4, "overall_score": 27, "findings": "Strong integration with productivity suite and centralized admin controls.", "mitigations": "Disable training on customer content, restrict connectors to approved repositories.", // type code here for "files" field // type code here for "relation_one" field "started_at": new Date('2026-03-05T09:30:00Z'), "completed_at": new Date('2026-03-22T15:10:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field "assessment_status": "needs_changes", "confidentiality_score": 4, "security_score": 4, "integration_readiness_score": 3, "legal_specific_risk_score": 4, "pricing_score": 2, "support_score": 4, "compliance_score": 4, "overall_score": 25, "findings": "Appropriate for research; ensure citation verification process in policy.", "mitigations": "Mandatory training on hallucination risk and primary source verification.", // type code here for "files" field // type code here for "relation_one" field "started_at": new Date('2026-02-12T11:00:00Z'), "completed_at": new Date('2026-02-28T16:30:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field "assessment_status": "rejected", "confidentiality_score": 5, "security_score": 5, "integration_readiness_score": 4, "legal_specific_risk_score": 4, "pricing_score": 3, "support_score": 4, "compliance_score": 5, "overall_score": 30, "findings": "Mature platform with strong RBAC and audit. Suitable for litigation workflows.", "mitigations": "Maintain matter-based access controls and periodic permission reviews.", // type code here for "files" field // type code here for "relation_one" field "started_at": new Date('2026-01-18T10:15:00Z'), "completed_at": new Date('2026-02-05T14:00:00Z'), }, ]; const PoliciesData = [ { "title": "AI Usage Baseline Policy", "policy_type": "practice_group_rule", "status": "archived", // type code here for "relation_one" field // type code here for "relation_one" field "summary": "Baseline permitted uses, prohibited uses, and required review controls.", "content": "Defines approved tools, prohibited content, review requirements, and audit expectations.", "effective_from": new Date('2026-01-01T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), // type code here for "files" field }, { "title": "Client Notice Template for AI Assistance", "policy_type": "forbidden_use", "status": "active", // type code here for "relation_one" field // type code here for "relation_one" field "summary": "Template language for notifying clients when AI tools assist with drafting.", "content": "Provides client-facing notice language and guidance on when to use it.", "effective_from": new Date('2026-02-01T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), // type code here for "files" field }, { "title": "Consent Language for Regulated Data", "policy_type": "practice_group_rule", "status": "draft", // type code here for "relation_one" field // type code here for "relation_one" field "summary": "Consent language and conditions for regulated data processing.", "content": "Specifies consent prerequisites, tool requirements, and retention controls.", "effective_from": new Date('2026-03-01T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), // type code here for "files" field }, { "title": "Forbidden Uses Policy", "policy_type": "consent_language", "status": "active", // type code here for "relation_one" field // type code here for "relation_one" field "summary": "Prohibits certain uses including unsupervised client advice and unauthorized filings.", "content": "Forbids using AI to provide unsupervised legal advice or to submit work without review.", "effective_from": new Date('2026-01-15T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), // type code here for "files" field }, { "title": "Practice Group Rule for Litigation Summaries", "policy_type": "consent_language", "status": "draft", // type code here for "relation_one" field // type code here for "relation_one" field "summary": "Litigation summaries must use approved tools and a mandatory checklist.", "content": "Requires redaction, citation checks, and partner review for client-facing summaries.", "effective_from": new Date('2026-04-01T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), // type code here for "files" field }, ]; const HumanReviewChecklistsData = [ { "name": "Client-Facing Draft Review", "purpose": "before_client_send", "status": "archived", // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "instructions": "Confirm confidentiality, verify factual assertions, and ensure policy compliance.", }, { "name": "Filing Readiness Review", "purpose": "before_client_send", "status": "draft", // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "instructions": "Verify citations, confirm procedural posture, and ensure attorney sign-off.", }, { "name": "Research Output Verification", "purpose": "before_filing", "status": "draft", // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "instructions": "Check primary sources, validate holdings, and document verification notes.", }, { "name": "Billing Narrative QA", "purpose": "before_billing", "status": "draft", // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "instructions": "Ensure narratives are accurate, non-privileged, and consistent with task codes.", }, { "name": "General AI Output Hygiene", "purpose": "general", "status": "draft", // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "instructions": "Confirm no sensitive identifiers, validate tone, and record any issues found.", }, ]; const ChecklistItemsData = [ { // type code here for "relation_one" field "item_text": "Confirm no client names or identifiers are included unless approved for this tool and classification.", "item_order": 1, "is_required": true, }, { // type code here for "relation_one" field "item_text": "Verify all factual statements against source documents or authoritative records.", "item_order": 2, "is_required": true, }, { // type code here for "relation_one" field "item_text": "Validate citations and ensure quoted text matches the record.", "item_order": 1, "is_required": true, }, { // type code here for "relation_one" field "item_text": "Confirm all cited authorities were checked in primary source databases.", "item_order": 1, "is_required": true, }, { // type code here for "relation_one" field "item_text": "Remove privileged strategy details and confirm narrative complies with client billing guidelines.", "item_order": 1, "is_required": true, }, ]; const TrainingCoursesData = [ { "name": "AI Governance Fundamentals for Legal Teams", "description": "Core training on approved tools, guardrails, and audit expectations.", "delivery_type": "live", "link": "https://training.example/legal-ai-governance", "duration_minutes": 45, "validity_days": 365, "status": "draft", // type code here for "files" field }, { "name": "Secure Prompting and Data Minimization", "description": "How to minimize sensitive data and use redaction patterns effectively.", "delivery_type": "document", "link": "https://training.example/secure-prompting", "duration_minutes": 35, "validity_days": 365, "status": "archived", // type code here for "files" field }, { "name": "Human Review Checklist Mastery", "description": "Applying checklists for client-facing and filing-bound work.", "delivery_type": "live", "link": "https://training.example/checklist-session", "duration_minutes": 60, "validity_days": 365, "status": "archived", // type code here for "files" field }, { "name": "Vendor Risk Awareness for Reviewers", "description": "Understanding SOC2, retention, subprocessors, and deletion commitments.", "delivery_type": "live", "link": "https://training.example/vendor-risk", "duration_minutes": 25, "validity_days": 730, "status": "archived", // type code here for "files" field }, { "name": "Research Verification and Citation Safety", "description": "Avoiding hallucinations and validating authorities prior to reliance.", "delivery_type": "lms_link", "link": "https://training.example/citation-safety", "duration_minutes": 40, "validity_days": 365, "status": "archived", // type code here for "files" field }, ]; const TrainingRequirementsData = [ { // type code here for "relation_one" field // type code here for "relation_one" field "is_required": true, }, { // type code here for "relation_one" field // type code here for "relation_one" field "is_required": true, }, { // type code here for "relation_one" field // type code here for "relation_one" field "is_required": true, }, { // type code here for "relation_one" field // type code here for "relation_one" field "is_required": true, }, { // type code here for "relation_one" field // type code here for "relation_one" field "is_required": true, }, ]; const UserTrainingRecordsData = [ { // type code here for "relation_one" field // type code here for "relation_one" field "completion_status": "not_started", "completed_at": new Date('2026-02-10T12:00:00Z'), "expires_at": new Date('2027-02-10T12:00:00Z'), "evidence_note": "Completed via internal LMS.", // type code here for "files" field }, { // type code here for "relation_one" field // type code here for "relation_one" field "completion_status": "not_started", "completed_at": new Date('2026-03-02T09:00:00Z'), "expires_at": new Date('2028-03-01T09:00:00Z'), "evidence_note": "Security reviewer training completed.", // type code here for "files" field }, { // type code here for "relation_one" field // type code here for "relation_one" field "completion_status": "expired", "completed_at": new Date('2026-04-12T15:30:00Z'), "expires_at": new Date('2027-04-12T15:30:00Z'), "evidence_note": "Completed secure prompting module.", // type code here for "files" field }, { // type code here for "relation_one" field // type code here for "relation_one" field "completion_status": "not_started", "completed_at": new Date('2026-03-15T10:10:00Z'), "expires_at": new Date('2027-03-15T10:10:00Z'), "evidence_note": "Completed citation safety training.", // type code here for "files" field }, { // type code here for "relation_one" field // type code here for "relation_one" field "completion_status": "completed", "completed_at": new Date('2026-04-01T16:00:00Z'), "expires_at": new Date('2027-04-01T16:00:00Z'), "evidence_note": "Attended live checklist session.", // type code here for "files" field }, ]; const ToolEntitlementsData = [ { // type code here for "relation_one" field // type code here for "relation_one" field "entitlement_status": "allowed", "effective_from": new Date('2026-04-15T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), "restriction_reason": "Completed required training and limited to approved use cases.", }, { // type code here for "relation_one" field // type code here for "relation_one" field "entitlement_status": "revoked", "effective_from": new Date('2026-03-25T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), "restriction_reason": "Allowed for internal intake triage only.", }, { // type code here for "relation_one" field // type code here for "relation_one" field "entitlement_status": "revoked", "effective_from": new Date('2026-02-28T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), "restriction_reason": "Approved for research with verification requirements.", }, { // type code here for "relation_one" field // type code here for "relation_one" field "entitlement_status": "restricted", "effective_from": new Date('2026-04-10T00:00:00Z'), "effective_to": new Date('2026-12-31T23:59:59Z'), "restriction_reason": "Reviewer access for testing and audit validation.", }, { // type code here for "relation_one" field // type code here for "relation_one" field "entitlement_status": "allowed", "effective_from": new Date('2026-05-01T00:00:00Z'), "effective_to": new Date('2026-06-30T23:59:59Z'), "restriction_reason": "Restricted pending completion of reviewer training and policy alignment.", }, ]; const WorkflowRunsData = [ { // 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 "review_status": "pending", "output_disposition": "rejected", "issues_found": "hallucination", "actual_hours_saved": 1.5, "run_cost": 6.5, "ran_at": new Date('2026-05-03T13:25:00Z'), "notes": "Memo outline used after citation verification.", }, { // 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 "review_status": "not_required", "output_disposition": "rejected", "issues_found": "bias", "actual_hours_saved": 0.8, "run_cost": 2.1, "ran_at": new Date('2026-05-06T17:40:00Z'), "notes": "Redaction needed before reuse in client communication.", }, { // 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 "review_status": "not_required", "output_disposition": "rejected", "issues_found": "hallucination", "actual_hours_saved": 0.6, "run_cost": 1.2, "ran_at": new Date('2026-05-08T09:05:00Z'), "notes": "Structured summary created from non-sensitive intake notes.", }, { // 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 "review_status": "not_required", "output_disposition": "needs_changes", "issues_found": "hallucination", "actual_hours_saved": 0.0, "run_cost": 0.8, "ran_at": new Date('2026-05-09T18:10:00Z'), "notes": "Narrative draft included strategy language; blocked for revision.", }, { // 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 "review_status": "in_review", "output_disposition": "approved", "issues_found": "none", "actual_hours_saved": 1.1, "run_cost": 3.4, "ran_at": new Date('2026-05-10T11:50:00Z'), "notes": "Clause comparison completed using clause-only inputs.", }, ]; const ReviewExceptionsData = [ { // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "exception_type": "other", "rationale": "Source document contained embedded identifiers that could not be removed in time; run output discarded.", "resolution_status": "approved", "raised_at": new Date('2026-05-06T18:10:00Z'), "resolved_at": new Date('2026-05-07T09:00:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "exception_type": "client_direction", "rationale": "Temporary draft generated for internal template only; not used for billing submission.", "resolution_status": "open", "raised_at": new Date('2026-05-09T18:20:00Z'), "resolved_at": new Date('2026-05-10T08:30:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "exception_type": "policy_override", "rationale": "Initial outline used for internal planning; full primary source check completed afterward.", "resolution_status": "approved", "raised_at": new Date('2026-05-03T13:40:00Z'), "resolved_at": new Date('2026-05-03T17:10:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "exception_type": "policy_override", "rationale": "Minor formatting issue noted; no sensitive data included.", "resolution_status": "open", "raised_at": new Date('2026-05-08T09:20:00Z'), "resolved_at": new Date('2026-05-08T10:00:00Z'), }, { // type code here for "relation_one" field // type code here for "relation_one" field // type code here for "relation_one" field "exception_type": "policy_override", "rationale": "Review deferred pending updated forbidden examples in billing policy.", "resolution_status": "approved", "raised_at": new Date('2026-05-09T18:30:00Z'), "resolved_at": new Date('2026-05-11T00:00:00Z'), }, ]; const IntegrationsData = [ { "name": "Microsoft Entra ID", "category": "automation", "integration_status": "available", "is_enabled": true, "configuration_notes": "SAML SSO enabled with conditional access and MFA.", // type code here for "files" field }, { "name": "Okta", "category": "other", "integration_status": "configured", "is_enabled": true, "configuration_notes": "Available as an alternative identity provider if needed.", // type code here for "files" field }, { "name": "SharePoint", "category": "dms", "integration_status": "available", "is_enabled": true, "configuration_notes": "Configured for metadata-only links; no document content ingestion by default.", // type code here for "files" field }, { "name": "Slack", "category": "dms", "integration_status": "available", "is_enabled": true, "configuration_notes": "Planned for approval notifications and escalation reminders.", // type code here for "files" field }, { "name": "Power BI", "category": "dms", "integration_status": "configured", "is_enabled": false, "configuration_notes": "Planned for ROI dashboards and cost reporting exports.", // type code here for "files" field }, ]; const RolesCatalogData = [ { "name": "Legal Operations Manager", "description": "Owns governance program operations, reporting, and configuration.", }, { "name": "General Counsel Reviewer", "description": "Reviews legal risk, client communications, and policy compliance.", }, { "name": "IT Security Reviewer", "description": "Assesses security posture, identity, logging, and data handling controls.", }, { "name": "Ethics and Risk Reviewer", "description": "Evaluates ethics, privilege, and professional responsibility risks.", }, { "name": "Attorney", "description": "Submits use cases, runs approved workflows, and completes required reviews.", }, ]; // Similar logic for "relation_many" async function associatePracticeGroupWithLead_user() { const relatedLead_user0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const PracticeGroup0 = await PracticeGroups.findOne({ order: [['id', 'ASC']], offset: 0 }); if (PracticeGroup0?.setLead_user) { await PracticeGroup0. setLead_user(relatedLead_user0); } const relatedLead_user1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const PracticeGroup1 = await PracticeGroups.findOne({ order: [['id', 'ASC']], offset: 1 }); if (PracticeGroup1?.setLead_user) { await PracticeGroup1. setLead_user(relatedLead_user1); } const relatedLead_user2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const PracticeGroup2 = await PracticeGroups.findOne({ order: [['id', 'ASC']], offset: 2 }); if (PracticeGroup2?.setLead_user) { await PracticeGroup2. setLead_user(relatedLead_user2); } const relatedLead_user3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const PracticeGroup3 = await PracticeGroups.findOne({ order: [['id', 'ASC']], offset: 3 }); if (PracticeGroup3?.setLead_user) { await PracticeGroup3. setLead_user(relatedLead_user3); } const relatedLead_user4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const PracticeGroup4 = await PracticeGroups.findOne({ order: [['id', 'ASC']], offset: 4 }); if (PracticeGroup4?.setLead_user) { await PracticeGroup4. setLead_user(relatedLead_user4); } } async function associateAiToolWithVendor() { const relatedVendor0 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const AiTool0 = await AiTools.findOne({ order: [['id', 'ASC']], offset: 0 }); if (AiTool0?.setVendor) { await AiTool0. setVendor(relatedVendor0); } const relatedVendor1 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const AiTool1 = await AiTools.findOne({ order: [['id', 'ASC']], offset: 1 }); if (AiTool1?.setVendor) { await AiTool1. setVendor(relatedVendor1); } const relatedVendor2 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const AiTool2 = await AiTools.findOne({ order: [['id', 'ASC']], offset: 2 }); if (AiTool2?.setVendor) { await AiTool2. setVendor(relatedVendor2); } const relatedVendor3 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const AiTool3 = await AiTools.findOne({ order: [['id', 'ASC']], offset: 3 }); if (AiTool3?.setVendor) { await AiTool3. setVendor(relatedVendor3); } const relatedVendor4 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const AiTool4 = await AiTools.findOne({ order: [['id', 'ASC']], offset: 4 }); if (AiTool4?.setVendor) { await AiTool4. setVendor(relatedVendor4); } } async function associateAiUseCasWithOwner() { const relatedOwner0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const AiUseCas0 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 0 }); if (AiUseCas0?.setOwner) { await AiUseCas0. setOwner(relatedOwner0); } const relatedOwner1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const AiUseCas1 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 1 }); if (AiUseCas1?.setOwner) { await AiUseCas1. setOwner(relatedOwner1); } const relatedOwner2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const AiUseCas2 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 2 }); if (AiUseCas2?.setOwner) { await AiUseCas2. setOwner(relatedOwner2); } const relatedOwner3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const AiUseCas3 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 3 }); if (AiUseCas3?.setOwner) { await AiUseCas3. setOwner(relatedOwner3); } const relatedOwner4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const AiUseCas4 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 4 }); if (AiUseCas4?.setOwner) { await AiUseCas4. setOwner(relatedOwner4); } } async function associateAiUseCasWithPractice_group() { const relatedPractice_group0 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const AiUseCas0 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 0 }); if (AiUseCas0?.setPractice_group) { await AiUseCas0. setPractice_group(relatedPractice_group0); } const relatedPractice_group1 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const AiUseCas1 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 1 }); if (AiUseCas1?.setPractice_group) { await AiUseCas1. setPractice_group(relatedPractice_group1); } const relatedPractice_group2 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const AiUseCas2 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 2 }); if (AiUseCas2?.setPractice_group) { await AiUseCas2. setPractice_group(relatedPractice_group2); } const relatedPractice_group3 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const AiUseCas3 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 3 }); if (AiUseCas3?.setPractice_group) { await AiUseCas3. setPractice_group(relatedPractice_group3); } const relatedPractice_group4 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const AiUseCas4 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 4 }); if (AiUseCas4?.setPractice_group) { await AiUseCas4. setPractice_group(relatedPractice_group4); } } async function associateAiUseCasWithMatter_type() { const relatedMatter_type0 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const AiUseCas0 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 0 }); if (AiUseCas0?.setMatter_type) { await AiUseCas0. setMatter_type(relatedMatter_type0); } const relatedMatter_type1 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const AiUseCas1 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 1 }); if (AiUseCas1?.setMatter_type) { await AiUseCas1. setMatter_type(relatedMatter_type1); } const relatedMatter_type2 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const AiUseCas2 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 2 }); if (AiUseCas2?.setMatter_type) { await AiUseCas2. setMatter_type(relatedMatter_type2); } const relatedMatter_type3 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const AiUseCas3 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 3 }); if (AiUseCas3?.setMatter_type) { await AiUseCas3. setMatter_type(relatedMatter_type3); } const relatedMatter_type4 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const AiUseCas4 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 4 }); if (AiUseCas4?.setMatter_type) { await AiUseCas4. setMatter_type(relatedMatter_type4); } } async function associateAiUseCasWithData_classification() { const relatedData_classification0 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const AiUseCas0 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 0 }); if (AiUseCas0?.setData_classification) { await AiUseCas0. setData_classification(relatedData_classification0); } const relatedData_classification1 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const AiUseCas1 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 1 }); if (AiUseCas1?.setData_classification) { await AiUseCas1. setData_classification(relatedData_classification1); } const relatedData_classification2 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const AiUseCas2 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 2 }); if (AiUseCas2?.setData_classification) { await AiUseCas2. setData_classification(relatedData_classification2); } const relatedData_classification3 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const AiUseCas3 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 3 }); if (AiUseCas3?.setData_classification) { await AiUseCas3. setData_classification(relatedData_classification3); } const relatedData_classification4 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const AiUseCas4 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 4 }); if (AiUseCas4?.setData_classification) { await AiUseCas4. setData_classification(relatedData_classification4); } } async function associateAiUseCasWithIntended_tool() { const relatedIntended_tool0 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const AiUseCas0 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 0 }); if (AiUseCas0?.setIntended_tool) { await AiUseCas0. setIntended_tool(relatedIntended_tool0); } const relatedIntended_tool1 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const AiUseCas1 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 1 }); if (AiUseCas1?.setIntended_tool) { await AiUseCas1. setIntended_tool(relatedIntended_tool1); } const relatedIntended_tool2 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const AiUseCas2 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 2 }); if (AiUseCas2?.setIntended_tool) { await AiUseCas2. setIntended_tool(relatedIntended_tool2); } const relatedIntended_tool3 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const AiUseCas3 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 3 }); if (AiUseCas3?.setIntended_tool) { await AiUseCas3. setIntended_tool(relatedIntended_tool3); } const relatedIntended_tool4 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const AiUseCas4 = await AiUseCases.findOne({ order: [['id', 'ASC']], offset: 4 }); if (AiUseCas4?.setIntended_tool) { await AiUseCas4. setIntended_tool(relatedIntended_tool4); } } async function associateApprovalStepWithUse_case() { const relatedUse_case0 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const ApprovalStep0 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ApprovalStep0?.setUse_case) { await ApprovalStep0. setUse_case(relatedUse_case0); } const relatedUse_case1 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const ApprovalStep1 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ApprovalStep1?.setUse_case) { await ApprovalStep1. setUse_case(relatedUse_case1); } const relatedUse_case2 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const ApprovalStep2 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ApprovalStep2?.setUse_case) { await ApprovalStep2. setUse_case(relatedUse_case2); } const relatedUse_case3 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const ApprovalStep3 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ApprovalStep3?.setUse_case) { await ApprovalStep3. setUse_case(relatedUse_case3); } const relatedUse_case4 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const ApprovalStep4 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ApprovalStep4?.setUse_case) { await ApprovalStep4. setUse_case(relatedUse_case4); } } async function associateApprovalStepWithAssigned_reviewer() { const relatedAssigned_reviewer0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ApprovalStep0 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ApprovalStep0?.setAssigned_reviewer) { await ApprovalStep0. setAssigned_reviewer(relatedAssigned_reviewer0); } const relatedAssigned_reviewer1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ApprovalStep1 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ApprovalStep1?.setAssigned_reviewer) { await ApprovalStep1. setAssigned_reviewer(relatedAssigned_reviewer1); } const relatedAssigned_reviewer2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ApprovalStep2 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ApprovalStep2?.setAssigned_reviewer) { await ApprovalStep2. setAssigned_reviewer(relatedAssigned_reviewer2); } const relatedAssigned_reviewer3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ApprovalStep3 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ApprovalStep3?.setAssigned_reviewer) { await ApprovalStep3. setAssigned_reviewer(relatedAssigned_reviewer3); } const relatedAssigned_reviewer4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ApprovalStep4 = await ApprovalSteps.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ApprovalStep4?.setAssigned_reviewer) { await ApprovalStep4. setAssigned_reviewer(relatedAssigned_reviewer4); } } async function associateVendorRiskAssessmentWithVendor() { const relatedVendor0 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const VendorRiskAssessment0 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 0 }); if (VendorRiskAssessment0?.setVendor) { await VendorRiskAssessment0. setVendor(relatedVendor0); } const relatedVendor1 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const VendorRiskAssessment1 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 1 }); if (VendorRiskAssessment1?.setVendor) { await VendorRiskAssessment1. setVendor(relatedVendor1); } const relatedVendor2 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const VendorRiskAssessment2 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 2 }); if (VendorRiskAssessment2?.setVendor) { await VendorRiskAssessment2. setVendor(relatedVendor2); } const relatedVendor3 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const VendorRiskAssessment3 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 3 }); if (VendorRiskAssessment3?.setVendor) { await VendorRiskAssessment3. setVendor(relatedVendor3); } const relatedVendor4 = await Vendors.findOne({ offset: Math.floor(Math.random() * (await Vendors.count())), }); const VendorRiskAssessment4 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 4 }); if (VendorRiskAssessment4?.setVendor) { await VendorRiskAssessment4. setVendor(relatedVendor4); } } async function associateVendorRiskAssessmentWithTool() { const relatedTool0 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const VendorRiskAssessment0 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 0 }); if (VendorRiskAssessment0?.setTool) { await VendorRiskAssessment0. setTool(relatedTool0); } const relatedTool1 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const VendorRiskAssessment1 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 1 }); if (VendorRiskAssessment1?.setTool) { await VendorRiskAssessment1. setTool(relatedTool1); } const relatedTool2 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const VendorRiskAssessment2 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 2 }); if (VendorRiskAssessment2?.setTool) { await VendorRiskAssessment2. setTool(relatedTool2); } const relatedTool3 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const VendorRiskAssessment3 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 3 }); if (VendorRiskAssessment3?.setTool) { await VendorRiskAssessment3. setTool(relatedTool3); } const relatedTool4 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const VendorRiskAssessment4 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 4 }); if (VendorRiskAssessment4?.setTool) { await VendorRiskAssessment4. setTool(relatedTool4); } } async function associateVendorRiskAssessmentWithOwner() { const relatedOwner0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const VendorRiskAssessment0 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 0 }); if (VendorRiskAssessment0?.setOwner) { await VendorRiskAssessment0. setOwner(relatedOwner0); } const relatedOwner1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const VendorRiskAssessment1 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 1 }); if (VendorRiskAssessment1?.setOwner) { await VendorRiskAssessment1. setOwner(relatedOwner1); } const relatedOwner2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const VendorRiskAssessment2 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 2 }); if (VendorRiskAssessment2?.setOwner) { await VendorRiskAssessment2. setOwner(relatedOwner2); } const relatedOwner3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const VendorRiskAssessment3 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 3 }); if (VendorRiskAssessment3?.setOwner) { await VendorRiskAssessment3. setOwner(relatedOwner3); } const relatedOwner4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const VendorRiskAssessment4 = await VendorRiskAssessments.findOne({ order: [['id', 'ASC']], offset: 4 }); if (VendorRiskAssessment4?.setOwner) { await VendorRiskAssessment4. setOwner(relatedOwner4); } } async function associatePolicyWithPractice_group() { const relatedPractice_group0 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const Policy0 = await Policies.findOne({ order: [['id', 'ASC']], offset: 0 }); if (Policy0?.setPractice_group) { await Policy0. setPractice_group(relatedPractice_group0); } const relatedPractice_group1 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const Policy1 = await Policies.findOne({ order: [['id', 'ASC']], offset: 1 }); if (Policy1?.setPractice_group) { await Policy1. setPractice_group(relatedPractice_group1); } const relatedPractice_group2 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const Policy2 = await Policies.findOne({ order: [['id', 'ASC']], offset: 2 }); if (Policy2?.setPractice_group) { await Policy2. setPractice_group(relatedPractice_group2); } const relatedPractice_group3 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const Policy3 = await Policies.findOne({ order: [['id', 'ASC']], offset: 3 }); if (Policy3?.setPractice_group) { await Policy3. setPractice_group(relatedPractice_group3); } const relatedPractice_group4 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const Policy4 = await Policies.findOne({ order: [['id', 'ASC']], offset: 4 }); if (Policy4?.setPractice_group) { await Policy4. setPractice_group(relatedPractice_group4); } } async function associatePolicyWithData_classification() { const relatedData_classification0 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const Policy0 = await Policies.findOne({ order: [['id', 'ASC']], offset: 0 }); if (Policy0?.setData_classification) { await Policy0. setData_classification(relatedData_classification0); } const relatedData_classification1 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const Policy1 = await Policies.findOne({ order: [['id', 'ASC']], offset: 1 }); if (Policy1?.setData_classification) { await Policy1. setData_classification(relatedData_classification1); } const relatedData_classification2 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const Policy2 = await Policies.findOne({ order: [['id', 'ASC']], offset: 2 }); if (Policy2?.setData_classification) { await Policy2. setData_classification(relatedData_classification2); } const relatedData_classification3 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const Policy3 = await Policies.findOne({ order: [['id', 'ASC']], offset: 3 }); if (Policy3?.setData_classification) { await Policy3. setData_classification(relatedData_classification3); } const relatedData_classification4 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const Policy4 = await Policies.findOne({ order: [['id', 'ASC']], offset: 4 }); if (Policy4?.setData_classification) { await Policy4. setData_classification(relatedData_classification4); } } async function associateHumanReviewChecklistWithPractice_group() { const relatedPractice_group0 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const HumanReviewChecklist0 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 0 }); if (HumanReviewChecklist0?.setPractice_group) { await HumanReviewChecklist0. setPractice_group(relatedPractice_group0); } const relatedPractice_group1 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const HumanReviewChecklist1 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 1 }); if (HumanReviewChecklist1?.setPractice_group) { await HumanReviewChecklist1. setPractice_group(relatedPractice_group1); } const relatedPractice_group2 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const HumanReviewChecklist2 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 2 }); if (HumanReviewChecklist2?.setPractice_group) { await HumanReviewChecklist2. setPractice_group(relatedPractice_group2); } const relatedPractice_group3 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const HumanReviewChecklist3 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 3 }); if (HumanReviewChecklist3?.setPractice_group) { await HumanReviewChecklist3. setPractice_group(relatedPractice_group3); } const relatedPractice_group4 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const HumanReviewChecklist4 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 4 }); if (HumanReviewChecklist4?.setPractice_group) { await HumanReviewChecklist4. setPractice_group(relatedPractice_group4); } } async function associateHumanReviewChecklistWithData_classification() { const relatedData_classification0 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const HumanReviewChecklist0 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 0 }); if (HumanReviewChecklist0?.setData_classification) { await HumanReviewChecklist0. setData_classification(relatedData_classification0); } const relatedData_classification1 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const HumanReviewChecklist1 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 1 }); if (HumanReviewChecklist1?.setData_classification) { await HumanReviewChecklist1. setData_classification(relatedData_classification1); } const relatedData_classification2 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const HumanReviewChecklist2 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 2 }); if (HumanReviewChecklist2?.setData_classification) { await HumanReviewChecklist2. setData_classification(relatedData_classification2); } const relatedData_classification3 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const HumanReviewChecklist3 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 3 }); if (HumanReviewChecklist3?.setData_classification) { await HumanReviewChecklist3. setData_classification(relatedData_classification3); } const relatedData_classification4 = await DataClassifications.findOne({ offset: Math.floor(Math.random() * (await DataClassifications.count())), }); const HumanReviewChecklist4 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 4 }); if (HumanReviewChecklist4?.setData_classification) { await HumanReviewChecklist4. setData_classification(relatedData_classification4); } } async function associateHumanReviewChecklistWithRequired_reviewer_role() { const relatedRequired_reviewer_role0 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const HumanReviewChecklist0 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 0 }); if (HumanReviewChecklist0?.setRequired_reviewer_role) { await HumanReviewChecklist0. setRequired_reviewer_role(relatedRequired_reviewer_role0); } const relatedRequired_reviewer_role1 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const HumanReviewChecklist1 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 1 }); if (HumanReviewChecklist1?.setRequired_reviewer_role) { await HumanReviewChecklist1. setRequired_reviewer_role(relatedRequired_reviewer_role1); } const relatedRequired_reviewer_role2 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const HumanReviewChecklist2 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 2 }); if (HumanReviewChecklist2?.setRequired_reviewer_role) { await HumanReviewChecklist2. setRequired_reviewer_role(relatedRequired_reviewer_role2); } const relatedRequired_reviewer_role3 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const HumanReviewChecklist3 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 3 }); if (HumanReviewChecklist3?.setRequired_reviewer_role) { await HumanReviewChecklist3. setRequired_reviewer_role(relatedRequired_reviewer_role3); } const relatedRequired_reviewer_role4 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const HumanReviewChecklist4 = await HumanReviewChecklists.findOne({ order: [['id', 'ASC']], offset: 4 }); if (HumanReviewChecklist4?.setRequired_reviewer_role) { await HumanReviewChecklist4. setRequired_reviewer_role(relatedRequired_reviewer_role4); } } async function associateChecklistItemWithChecklist() { const relatedChecklist0 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ChecklistItem0 = await ChecklistItems.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ChecklistItem0?.setChecklist) { await ChecklistItem0. setChecklist(relatedChecklist0); } const relatedChecklist1 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ChecklistItem1 = await ChecklistItems.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ChecklistItem1?.setChecklist) { await ChecklistItem1. setChecklist(relatedChecklist1); } const relatedChecklist2 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ChecklistItem2 = await ChecklistItems.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ChecklistItem2?.setChecklist) { await ChecklistItem2. setChecklist(relatedChecklist2); } const relatedChecklist3 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ChecklistItem3 = await ChecklistItems.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ChecklistItem3?.setChecklist) { await ChecklistItem3. setChecklist(relatedChecklist3); } const relatedChecklist4 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ChecklistItem4 = await ChecklistItems.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ChecklistItem4?.setChecklist) { await ChecklistItem4. setChecklist(relatedChecklist4); } } async function associateTrainingRequirementWithCourse() { const relatedCourse0 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const TrainingRequirement0 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 0 }); if (TrainingRequirement0?.setCourse) { await TrainingRequirement0. setCourse(relatedCourse0); } const relatedCourse1 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const TrainingRequirement1 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 1 }); if (TrainingRequirement1?.setCourse) { await TrainingRequirement1. setCourse(relatedCourse1); } const relatedCourse2 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const TrainingRequirement2 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 2 }); if (TrainingRequirement2?.setCourse) { await TrainingRequirement2. setCourse(relatedCourse2); } const relatedCourse3 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const TrainingRequirement3 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 3 }); if (TrainingRequirement3?.setCourse) { await TrainingRequirement3. setCourse(relatedCourse3); } const relatedCourse4 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const TrainingRequirement4 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 4 }); if (TrainingRequirement4?.setCourse) { await TrainingRequirement4. setCourse(relatedCourse4); } } async function associateTrainingRequirementWithRole() { const relatedRole0 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const TrainingRequirement0 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 0 }); if (TrainingRequirement0?.setRole) { await TrainingRequirement0. setRole(relatedRole0); } const relatedRole1 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const TrainingRequirement1 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 1 }); if (TrainingRequirement1?.setRole) { await TrainingRequirement1. setRole(relatedRole1); } const relatedRole2 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const TrainingRequirement2 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 2 }); if (TrainingRequirement2?.setRole) { await TrainingRequirement2. setRole(relatedRole2); } const relatedRole3 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const TrainingRequirement3 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 3 }); if (TrainingRequirement3?.setRole) { await TrainingRequirement3. setRole(relatedRole3); } const relatedRole4 = await RolesCatalog.findOne({ offset: Math.floor(Math.random() * (await RolesCatalog.count())), }); const TrainingRequirement4 = await TrainingRequirements.findOne({ order: [['id', 'ASC']], offset: 4 }); if (TrainingRequirement4?.setRole) { await TrainingRequirement4. setRole(relatedRole4); } } async function associateUserTrainingRecordWithUser() { const relatedUser0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const UserTrainingRecord0 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 0 }); if (UserTrainingRecord0?.setUser) { await UserTrainingRecord0. setUser(relatedUser0); } const relatedUser1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const UserTrainingRecord1 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 1 }); if (UserTrainingRecord1?.setUser) { await UserTrainingRecord1. setUser(relatedUser1); } const relatedUser2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const UserTrainingRecord2 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 2 }); if (UserTrainingRecord2?.setUser) { await UserTrainingRecord2. setUser(relatedUser2); } const relatedUser3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const UserTrainingRecord3 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 3 }); if (UserTrainingRecord3?.setUser) { await UserTrainingRecord3. setUser(relatedUser3); } const relatedUser4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const UserTrainingRecord4 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 4 }); if (UserTrainingRecord4?.setUser) { await UserTrainingRecord4. setUser(relatedUser4); } } async function associateUserTrainingRecordWithCourse() { const relatedCourse0 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const UserTrainingRecord0 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 0 }); if (UserTrainingRecord0?.setCourse) { await UserTrainingRecord0. setCourse(relatedCourse0); } const relatedCourse1 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const UserTrainingRecord1 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 1 }); if (UserTrainingRecord1?.setCourse) { await UserTrainingRecord1. setCourse(relatedCourse1); } const relatedCourse2 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const UserTrainingRecord2 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 2 }); if (UserTrainingRecord2?.setCourse) { await UserTrainingRecord2. setCourse(relatedCourse2); } const relatedCourse3 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const UserTrainingRecord3 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 3 }); if (UserTrainingRecord3?.setCourse) { await UserTrainingRecord3. setCourse(relatedCourse3); } const relatedCourse4 = await TrainingCourses.findOne({ offset: Math.floor(Math.random() * (await TrainingCourses.count())), }); const UserTrainingRecord4 = await UserTrainingRecords.findOne({ order: [['id', 'ASC']], offset: 4 }); if (UserTrainingRecord4?.setCourse) { await UserTrainingRecord4. setCourse(relatedCourse4); } } async function associateToolEntitlementWithUser() { const relatedUser0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ToolEntitlement0 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ToolEntitlement0?.setUser) { await ToolEntitlement0. setUser(relatedUser0); } const relatedUser1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ToolEntitlement1 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ToolEntitlement1?.setUser) { await ToolEntitlement1. setUser(relatedUser1); } const relatedUser2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ToolEntitlement2 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ToolEntitlement2?.setUser) { await ToolEntitlement2. setUser(relatedUser2); } const relatedUser3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ToolEntitlement3 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ToolEntitlement3?.setUser) { await ToolEntitlement3. setUser(relatedUser3); } const relatedUser4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ToolEntitlement4 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ToolEntitlement4?.setUser) { await ToolEntitlement4. setUser(relatedUser4); } } async function associateToolEntitlementWithTool() { const relatedTool0 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const ToolEntitlement0 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ToolEntitlement0?.setTool) { await ToolEntitlement0. setTool(relatedTool0); } const relatedTool1 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const ToolEntitlement1 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ToolEntitlement1?.setTool) { await ToolEntitlement1. setTool(relatedTool1); } const relatedTool2 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const ToolEntitlement2 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ToolEntitlement2?.setTool) { await ToolEntitlement2. setTool(relatedTool2); } const relatedTool3 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const ToolEntitlement3 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ToolEntitlement3?.setTool) { await ToolEntitlement3. setTool(relatedTool3); } const relatedTool4 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const ToolEntitlement4 = await ToolEntitlements.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ToolEntitlement4?.setTool) { await ToolEntitlement4. setTool(relatedTool4); } } async function associateWorkflowRunWithUse_case() { const relatedUse_case0 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const WorkflowRun0 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 0 }); if (WorkflowRun0?.setUse_case) { await WorkflowRun0. setUse_case(relatedUse_case0); } const relatedUse_case1 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const WorkflowRun1 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 1 }); if (WorkflowRun1?.setUse_case) { await WorkflowRun1. setUse_case(relatedUse_case1); } const relatedUse_case2 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const WorkflowRun2 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 2 }); if (WorkflowRun2?.setUse_case) { await WorkflowRun2. setUse_case(relatedUse_case2); } const relatedUse_case3 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const WorkflowRun3 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 3 }); if (WorkflowRun3?.setUse_case) { await WorkflowRun3. setUse_case(relatedUse_case3); } const relatedUse_case4 = await AiUseCases.findOne({ offset: Math.floor(Math.random() * (await AiUseCases.count())), }); const WorkflowRun4 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 4 }); if (WorkflowRun4?.setUse_case) { await WorkflowRun4. setUse_case(relatedUse_case4); } } async function associateWorkflowRunWithUser() { const relatedUser0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const WorkflowRun0 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 0 }); if (WorkflowRun0?.setUser) { await WorkflowRun0. setUser(relatedUser0); } const relatedUser1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const WorkflowRun1 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 1 }); if (WorkflowRun1?.setUser) { await WorkflowRun1. setUser(relatedUser1); } const relatedUser2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const WorkflowRun2 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 2 }); if (WorkflowRun2?.setUser) { await WorkflowRun2. setUser(relatedUser2); } const relatedUser3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const WorkflowRun3 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 3 }); if (WorkflowRun3?.setUser) { await WorkflowRun3. setUser(relatedUser3); } const relatedUser4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const WorkflowRun4 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 4 }); if (WorkflowRun4?.setUser) { await WorkflowRun4. setUser(relatedUser4); } } async function associateWorkflowRunWithTool() { const relatedTool0 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const WorkflowRun0 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 0 }); if (WorkflowRun0?.setTool) { await WorkflowRun0. setTool(relatedTool0); } const relatedTool1 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const WorkflowRun1 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 1 }); if (WorkflowRun1?.setTool) { await WorkflowRun1. setTool(relatedTool1); } const relatedTool2 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const WorkflowRun2 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 2 }); if (WorkflowRun2?.setTool) { await WorkflowRun2. setTool(relatedTool2); } const relatedTool3 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const WorkflowRun3 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 3 }); if (WorkflowRun3?.setTool) { await WorkflowRun3. setTool(relatedTool3); } const relatedTool4 = await AiTools.findOne({ offset: Math.floor(Math.random() * (await AiTools.count())), }); const WorkflowRun4 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 4 }); if (WorkflowRun4?.setTool) { await WorkflowRun4. setTool(relatedTool4); } } async function associateWorkflowRunWithPractice_group() { const relatedPractice_group0 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const WorkflowRun0 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 0 }); if (WorkflowRun0?.setPractice_group) { await WorkflowRun0. setPractice_group(relatedPractice_group0); } const relatedPractice_group1 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const WorkflowRun1 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 1 }); if (WorkflowRun1?.setPractice_group) { await WorkflowRun1. setPractice_group(relatedPractice_group1); } const relatedPractice_group2 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const WorkflowRun2 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 2 }); if (WorkflowRun2?.setPractice_group) { await WorkflowRun2. setPractice_group(relatedPractice_group2); } const relatedPractice_group3 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const WorkflowRun3 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 3 }); if (WorkflowRun3?.setPractice_group) { await WorkflowRun3. setPractice_group(relatedPractice_group3); } const relatedPractice_group4 = await PracticeGroups.findOne({ offset: Math.floor(Math.random() * (await PracticeGroups.count())), }); const WorkflowRun4 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 4 }); if (WorkflowRun4?.setPractice_group) { await WorkflowRun4. setPractice_group(relatedPractice_group4); } } async function associateWorkflowRunWithMatter_type() { const relatedMatter_type0 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const WorkflowRun0 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 0 }); if (WorkflowRun0?.setMatter_type) { await WorkflowRun0. setMatter_type(relatedMatter_type0); } const relatedMatter_type1 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const WorkflowRun1 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 1 }); if (WorkflowRun1?.setMatter_type) { await WorkflowRun1. setMatter_type(relatedMatter_type1); } const relatedMatter_type2 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const WorkflowRun2 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 2 }); if (WorkflowRun2?.setMatter_type) { await WorkflowRun2. setMatter_type(relatedMatter_type2); } const relatedMatter_type3 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const WorkflowRun3 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 3 }); if (WorkflowRun3?.setMatter_type) { await WorkflowRun3. setMatter_type(relatedMatter_type3); } const relatedMatter_type4 = await MatterTypes.findOne({ offset: Math.floor(Math.random() * (await MatterTypes.count())), }); const WorkflowRun4 = await WorkflowRuns.findOne({ order: [['id', 'ASC']], offset: 4 }); if (WorkflowRun4?.setMatter_type) { await WorkflowRun4. setMatter_type(relatedMatter_type4); } } async function associateReviewExceptionWithWorkflow_run() { const relatedWorkflow_run0 = await WorkflowRuns.findOne({ offset: Math.floor(Math.random() * (await WorkflowRuns.count())), }); const ReviewException0 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ReviewException0?.setWorkflow_run) { await ReviewException0. setWorkflow_run(relatedWorkflow_run0); } const relatedWorkflow_run1 = await WorkflowRuns.findOne({ offset: Math.floor(Math.random() * (await WorkflowRuns.count())), }); const ReviewException1 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ReviewException1?.setWorkflow_run) { await ReviewException1. setWorkflow_run(relatedWorkflow_run1); } const relatedWorkflow_run2 = await WorkflowRuns.findOne({ offset: Math.floor(Math.random() * (await WorkflowRuns.count())), }); const ReviewException2 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ReviewException2?.setWorkflow_run) { await ReviewException2. setWorkflow_run(relatedWorkflow_run2); } const relatedWorkflow_run3 = await WorkflowRuns.findOne({ offset: Math.floor(Math.random() * (await WorkflowRuns.count())), }); const ReviewException3 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ReviewException3?.setWorkflow_run) { await ReviewException3. setWorkflow_run(relatedWorkflow_run3); } const relatedWorkflow_run4 = await WorkflowRuns.findOne({ offset: Math.floor(Math.random() * (await WorkflowRuns.count())), }); const ReviewException4 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ReviewException4?.setWorkflow_run) { await ReviewException4. setWorkflow_run(relatedWorkflow_run4); } } async function associateReviewExceptionWithChecklist() { const relatedChecklist0 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ReviewException0 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ReviewException0?.setChecklist) { await ReviewException0. setChecklist(relatedChecklist0); } const relatedChecklist1 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ReviewException1 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ReviewException1?.setChecklist) { await ReviewException1. setChecklist(relatedChecklist1); } const relatedChecklist2 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ReviewException2 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ReviewException2?.setChecklist) { await ReviewException2. setChecklist(relatedChecklist2); } const relatedChecklist3 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ReviewException3 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ReviewException3?.setChecklist) { await ReviewException3. setChecklist(relatedChecklist3); } const relatedChecklist4 = await HumanReviewChecklists.findOne({ offset: Math.floor(Math.random() * (await HumanReviewChecklists.count())), }); const ReviewException4 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ReviewException4?.setChecklist) { await ReviewException4. setChecklist(relatedChecklist4); } } async function associateReviewExceptionWithRaised_by() { const relatedRaised_by0 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ReviewException0 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 0 }); if (ReviewException0?.setRaised_by) { await ReviewException0. setRaised_by(relatedRaised_by0); } const relatedRaised_by1 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ReviewException1 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 1 }); if (ReviewException1?.setRaised_by) { await ReviewException1. setRaised_by(relatedRaised_by1); } const relatedRaised_by2 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ReviewException2 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 2 }); if (ReviewException2?.setRaised_by) { await ReviewException2. setRaised_by(relatedRaised_by2); } const relatedRaised_by3 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ReviewException3 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 3 }); if (ReviewException3?.setRaised_by) { await ReviewException3. setRaised_by(relatedRaised_by3); } const relatedRaised_by4 = await Users.findOne({ offset: Math.floor(Math.random() * (await Users.count())), }); const ReviewException4 = await ReviewExceptions.findOne({ order: [['id', 'ASC']], offset: 4 }); if (ReviewException4?.setRaised_by) { await ReviewException4. setRaised_by(relatedRaised_by4); } } module.exports = { up: async (queryInterface, Sequelize) => { await PracticeGroups.bulkCreate(PracticeGroupsData); await MatterTypes.bulkCreate(MatterTypesData); await DataClassifications.bulkCreate(DataClassificationsData); await AiTools.bulkCreate(AiToolsData); await Vendors.bulkCreate(VendorsData); await AiUseCases.bulkCreate(AiUseCasesData); await ApprovalSteps.bulkCreate(ApprovalStepsData); await VendorRiskAssessments.bulkCreate(VendorRiskAssessmentsData); await Policies.bulkCreate(PoliciesData); await HumanReviewChecklists.bulkCreate(HumanReviewChecklistsData); await ChecklistItems.bulkCreate(ChecklistItemsData); await TrainingCourses.bulkCreate(TrainingCoursesData); await TrainingRequirements.bulkCreate(TrainingRequirementsData); await UserTrainingRecords.bulkCreate(UserTrainingRecordsData); await ToolEntitlements.bulkCreate(ToolEntitlementsData); await WorkflowRuns.bulkCreate(WorkflowRunsData); await ReviewExceptions.bulkCreate(ReviewExceptionsData); await Integrations.bulkCreate(IntegrationsData); await RolesCatalog.bulkCreate(RolesCatalogData); await Promise.all([ // Similar logic for "relation_many" await associatePracticeGroupWithLead_user(), await associateAiToolWithVendor(), await associateAiUseCasWithOwner(), await associateAiUseCasWithPractice_group(), await associateAiUseCasWithMatter_type(), await associateAiUseCasWithData_classification(), await associateAiUseCasWithIntended_tool(), await associateApprovalStepWithUse_case(), await associateApprovalStepWithAssigned_reviewer(), await associateVendorRiskAssessmentWithVendor(), await associateVendorRiskAssessmentWithTool(), await associateVendorRiskAssessmentWithOwner(), await associatePolicyWithPractice_group(), await associatePolicyWithData_classification(), await associateHumanReviewChecklistWithPractice_group(), await associateHumanReviewChecklistWithData_classification(), await associateHumanReviewChecklistWithRequired_reviewer_role(), await associateChecklistItemWithChecklist(), await associateTrainingRequirementWithCourse(), await associateTrainingRequirementWithRole(), await associateUserTrainingRecordWithUser(), await associateUserTrainingRecordWithCourse(), await associateToolEntitlementWithUser(), await associateToolEntitlementWithTool(), await associateWorkflowRunWithUse_case(), await associateWorkflowRunWithUser(), await associateWorkflowRunWithTool(), await associateWorkflowRunWithPractice_group(), await associateWorkflowRunWithMatter_type(), await associateReviewExceptionWithWorkflow_run(), await associateReviewExceptionWithChecklist(), await associateReviewExceptionWithRaised_by(), ]); }, down: async (queryInterface, Sequelize) => { await queryInterface.bulkDelete('practice_groups', null, {}); await queryInterface.bulkDelete('matter_types', null, {}); await queryInterface.bulkDelete('data_classifications', null, {}); await queryInterface.bulkDelete('ai_tools', null, {}); await queryInterface.bulkDelete('vendors', null, {}); await queryInterface.bulkDelete('ai_use_cases', null, {}); await queryInterface.bulkDelete('approval_steps', null, {}); await queryInterface.bulkDelete('vendor_risk_assessments', null, {}); await queryInterface.bulkDelete('policies', null, {}); await queryInterface.bulkDelete('human_review_checklists', null, {}); await queryInterface.bulkDelete('checklist_items', null, {}); await queryInterface.bulkDelete('training_courses', null, {}); await queryInterface.bulkDelete('training_requirements', null, {}); await queryInterface.bulkDelete('user_training_records', null, {}); await queryInterface.bulkDelete('tool_entitlements', null, {}); await queryInterface.bulkDelete('workflow_runs', null, {}); await queryInterface.bulkDelete('review_exceptions', null, {}); await queryInterface.bulkDelete('integrations', null, {}); await queryInterface.bulkDelete('roles_catalog', null, {}); }, };