38544-vm/backend/src/db/seeders/20231127130745-sample-data.js
2026-02-17 22:06:44 +00:00

14357 lines
301 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const Organizations = db.organizations;
const UserProfiles = db.user_profiles;
const UserProfileTypes = db.user_profile_types;
const Declarations = db.declarations;
const Dependents = db.dependents;
const DataSources = db.data_sources;
const Transactions = db.transactions;
const Documents = db.documents;
const IncomePayersPj = db.income_payers_pj;
const IncomeCarneLeaoMonthly = db.income_carne_leao_monthly;
const ExemptIncomes = db.exempt_incomes;
const ExclusiveIncomes = db.exclusive_incomes;
const Assets = db.assets;
const Debts = db.debts;
const DeductiblePayments = db.deductible_payments;
const InvestmentPositions = db.investment_positions;
const Trades = db.trades;
const MonthlyCapitalGains = db.monthly_capital_gains;
const RiskAnalyses = db.risk_analyses;
const Notifications = db.notifications;
const OrganizationMemberships = db.organization_memberships;
const AccountantClientAccesses = db.accountant_client_accesses;
const AuditLogs = db.audit_logs;
const Consents = db.consents;
const JobRuns = db.job_runs;
const OrganizationsData = [
{
"name": "DeclaraFacil Plataforma",
},
{
"name": "Contabilidade Horizonte",
},
{
"name": "Mendes Assessoria Contabil",
},
{
"name": "Sul Contabil Digital",
},
{
"name": "Oliveira Contadores",
},
];
const UserProfilesData = [
{
// type code here for "relation_one" field
"cpf": "123.456.789-09",
"birth_date": new Date('1987-05-18T00:00:00Z'),
"marital_status": "solteiro",
"spouse_cpf": "987.654.321-00",
"spouse_name": "Joao Silva",
"mother_name": "Helena Silva",
"cep": "01310-000",
"street": "Avenida Paulista",
"house_number": "1000",
"address_complement": "Apto 121",
"neighborhood": "Bela Vista",
"city": "Sao Paulo",
"state_uf": "SP",
"phone": "+55 11 98888-1111",
"occupation_text": "Analista de Sistemas",
"occupation_code": "10",
"cbo_code": "2124-05",
"main_source_cnpj": "12.345.678/0001-90",
"voter_title": "123456789012",
"voter_zone": "010",
"voter_section": "0123",
"nit_pis_pasep": "123.45678.90-1",
"caepf_number": "CAEPF-00000001",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"cpf": "234.567.890-12",
"birth_date": new Date('1984-11-02T00:00:00Z'),
"marital_status": "uniao_estavel",
"spouse_cpf": "",
"spouse_name": "",
"mother_name": "Marcia Mendes",
"cep": "30110-000",
"street": "Avenida Afonso Pena",
"house_number": "1500",
"address_complement": "Sala 402",
"neighborhood": "Centro",
"city": "Belo Horizonte",
"state_uf": "MG",
"phone": "+55 31 97777-2222",
"occupation_text": "Designer Freelancer",
"occupation_code": "12",
"cbo_code": "2624-10",
"main_source_cnpj": "23.456.789/0001-10",
"voter_title": "234567890123",
"voter_zone": "125",
"voter_section": "0456",
"nit_pis_pasep": "234.56789.01-2",
"caepf_number": "CAEPF-00000002",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"cpf": "345.678.901-23",
"birth_date": new Date('1990-03-22T00:00:00Z'),
"marital_status": "casado",
"spouse_cpf": "456.789.012-34",
"spouse_name": "Rafael Almeida",
"mother_name": "Sonia Santos",
"cep": "40110-000",
"street": "Avenida Sete de Setembro",
"house_number": "2500",
"address_complement": "Bloco B",
"neighborhood": "Barra",
"city": "Salvador",
"state_uf": "BA",
"phone": "+55 71 96666-3333",
"occupation_text": "Empreendedora MEI",
"occupation_code": "22",
"cbo_code": "1423-20",
"main_source_cnpj": "34.567.890/0001-20",
"voter_title": "345678901234",
"voter_zone": "090",
"voter_section": "0789",
"nit_pis_pasep": "345.67890.12-3",
"caepf_number": "CAEPF-00000003",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"cpf": "456.789.012-34",
"birth_date": new Date('1982-07-09T00:00:00Z'),
"marital_status": "divorciado",
"spouse_cpf": "",
"spouse_name": "",
"mother_name": "Lucia Souza",
"cep": "70040-010",
"street": "Esplanada dos Ministerios",
"house_number": "1",
"address_complement": "Edificio Anexo",
"neighborhood": "Zona Civico-Administrativa",
"city": "Brasilia",
"state_uf": "DF",
"phone": "+55 61 95555-4444",
"occupation_text": "Gestora de Produto",
"occupation_code": "10",
"cbo_code": "1421-05",
"main_source_cnpj": "45.678.901/0001-30",
"voter_title": "456789012345",
"voter_zone": "001",
"voter_section": "0101",
"nit_pis_pasep": "456.78901.23-4",
"caepf_number": "CAEPF-00000004",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"cpf": "567.890.123-45",
"birth_date": new Date('1986-01-30T00:00:00Z'),
"marital_status": "viuvo",
"spouse_cpf": "678.901.234-56",
"spouse_name": "Patricia Teixeira",
"mother_name": "Regina Teixeira",
"cep": "80010-000",
"street": "Rua XV de Novembro",
"house_number": "500",
"address_complement": "Conjunto 12",
"neighborhood": "Centro",
"city": "Curitiba",
"state_uf": "PR",
"phone": "+55 41 94444-5555",
"occupation_text": "Engenheiro de Software",
"occupation_code": "10",
"cbo_code": "2123-05",
"main_source_cnpj": "56.789.012/0001-40",
"voter_title": "567890123456",
"voter_zone": "020",
"voter_section": "0302",
"nit_pis_pasep": "567.89012.34-5",
"caepf_number": "CAEPF-00000005",
// type code here for "relation_one" field
},
];
const UserProfileTypesData = [
{
// type code here for "relation_one" field
"profile_type": "assalariado",
"enabled": true,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"profile_type": "investidor",
"enabled": false,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"profile_type": "investidor",
"enabled": true,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"profile_type": "autonomo_mei",
"enabled": true,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"profile_type": "proprietario",
"enabled": true,
// type code here for "relation_one" field
},
];
const DeclarationsData = [
{
// type code here for "relation_one" field
"base_year": 2024,
"status": "gerada",
"tax_model": "simplificado",
"declaration_type": "original",
"previous_receipt_number": "",
"tax_calculated": 12450.32,
"tax_withheld": 15620.55,
"refund_amount": 2810.23,
"payable_amount": 0,
"risk_score": 18,
"risk_details_json": "{summary:Baixo risco,issues:[]}",
"dec_file_url": "https://storage.supabase.example/dec/maria_2024.dec",
"submitted_at": new Date('2025-04-15T14:00:00Z'),
"last_calculated_at": new Date('2025-04-15T13:45:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"base_year": 2023,
"status": "rascunho",
"tax_model": "simplificado",
"declaration_type": "retificadora",
"previous_receipt_number": "",
"tax_calculated": 11890.11,
"tax_withheld": 14220.44,
"refund_amount": 2330.33,
"payable_amount": 0,
"risk_score": 22,
"risk_details_json": "{summary:Baixo risco,issues:[]}",
"dec_file_url": "https://storage.supabase.example/dec/maria_2023.dec",
"submitted_at": new Date('2024-04-20T16:10:00Z'),
"last_calculated_at": new Date('2024-04-20T15:50:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"base_year": 2024,
"status": "aguardando_revisao",
"tax_model": "simplificado",
"declaration_type": "retificadora",
"previous_receipt_number": "",
"tax_calculated": 6420.88,
"tax_withheld": 5020.12,
"refund_amount": 0,
"payable_amount": 1200.76,
"risk_score": 54,
"risk_details_json": "{summary:Risco moderado,issues:[Deducao sem documento]}",
"dec_file_url": "",
"submitted_at": new Date('2020-01-01T00:00:00Z'),
"last_calculated_at": new Date('2025-03-28T10:20:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"base_year": 2023,
"status": "enviada",
"tax_model": "simplificado",
"declaration_type": "retificadora",
"previous_receipt_number": "",
"tax_calculated": 5120.5,
"tax_withheld": 4300.2,
"refund_amount": 0,
"payable_amount": 820.3,
"risk_score": 41,
"risk_details_json": "{summary:Risco moderado,issues:[]}",
"dec_file_url": "https://storage.supabase.example/dec/carlos_2023.dec",
"submitted_at": new Date('2024-04-27T19:00:00Z'),
"last_calculated_at": new Date('2024-04-27T18:30:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"base_year": 2024,
"status": "aguardando_revisao",
"tax_model": "simplificado",
"declaration_type": "retificadora",
"previous_receipt_number": "",
"tax_calculated": 3890.25,
"tax_withheld": 4100.1,
"refund_amount": 450.0,
"payable_amount": 0,
"risk_score": 29,
"risk_details_json": "{summary:Baixo risco,issues:[]}",
"dec_file_url": "https://storage.supabase.example/dec/beatriz_2024.dec",
"submitted_at": new Date('2025-04-10T12:05:00Z'),
"last_calculated_at": new Date('2025-04-10T11:40:00Z'),
// type code here for "relation_one" field
},
];
const DependentsData = [
{
// type code here for "relation_one" field
"name": "Pedro Silva",
"cpf": "111.222.333-44",
"birth_date": new Date('2013-09-12T00:00:00Z'),
"relationship_code": "21",
"student": true,
"health_plan": true,
"own_income": 0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"name": "Laura Silva",
"cpf": "222.333.444-55",
"birth_date": new Date('2016-02-01T00:00:00Z'),
"relationship_code": "21",
"student": true,
"health_plan": true,
"own_income": 0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"name": "Marta Santos",
"cpf": "333.444.555-66",
"birth_date": new Date('1957-08-19T00:00:00Z'),
"relationship_code": "11",
"student": true,
"health_plan": true,
"own_income": 0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"name": "Pedro Silva",
"cpf": "111.222.333-44",
"birth_date": new Date('2013-09-12T00:00:00Z'),
"relationship_code": "21",
"student": true,
"health_plan": true,
"own_income": 0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"name": "Henrique Mendes",
"cpf": "444.555.666-77",
"birth_date": new Date('2010-06-05T00:00:00Z'),
"relationship_code": "99",
"student": false,
"health_plan": true,
"own_income": 0,
// type code here for "relation_one" field
},
];
const DataSourcesData = [
{
// type code here for "relation_one" field
"source_type": "sefaz_nfe",
"institution_name": "e-CAC",
"status": "desconectado",
"imported_payload_json": "{prefilled:true,years:[2023,2024]}",
"imported_at": new Date('2025-02-20T09:10:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"source_type": "manual",
"institution_name": "Nubank",
"status": "conectado",
"imported_payload_json": "{accounts:2,transactions:847}",
"imported_at": new Date('2025-02-22T11:30:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"source_type": "govbr_ecac",
"institution_name": "XP Investimentos",
"status": "desconectado",
"imported_payload_json": "{positions:12,trades:58,dividends:24}",
"imported_at": new Date('2025-03-05T15:40:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"source_type": "open_finance",
"institution_name": "SEFAZ BA",
"status": "erro",
"imported_payload_json": "{nfe_emitidas:42,nfe_recebidas:8}",
"imported_at": new Date('2025-02-28T13:25:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"source_type": "brokerage",
"institution_name": "Itau",
"status": "sucesso",
"imported_payload_json": "{accounts:1,transactions:312,warning:faltam lancamentos de janeiro}",
"imported_at": new Date('2025-03-02T08:55:00Z'),
// type code here for "relation_one" field
},
];
const TransactionsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"transaction_date": new Date('2024-01-05T00:00:00Z'),
"description": "CREDITO SALARIO XPTO TECNOLOGIA LTDA",
"amount": 8400.0,
"direction": "debit",
"ai_category": "Salario",
"ir_field": "salarios_ordenados",
"ir_form": "Rendimentos Tributaveis Recebidos de PJ",
"taxation_type": "exclusivo_fonte",
"confidence_score": 96,
"reviewed_by_user": true,
"requires_human_review": true,
"review_reason": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"transaction_date": new Date('2024-02-10T00:00:00Z'),
"description": "DEBITO PLANO SAUDE SAUDEBEM",
"amount": 680.0,
"direction": "debit",
"ai_category": "Plano de Saude",
"ir_field": "pagamentos_plano_saude",
"ir_form": "Pagamentos Efetuados",
"taxation_type": "exclusivo_fonte",
"confidence_score": 88,
"reviewed_by_user": true,
"requires_human_review": false,
"review_reason": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"transaction_date": new Date('2024-03-15T00:00:00Z'),
"description": "PIX RECEBIDO FREELANCE DESIGN",
"amount": 2500.0,
"direction": "credit",
"ai_category": "Prestacao de servicos",
"ir_field": "carne_leao_pf",
"ir_form": "Rendimentos Tributaveis Recebidos de PF",
"taxation_type": "nao_tributavel",
"confidence_score": 82,
"reviewed_by_user": false,
"requires_human_review": true,
"review_reason": "Falta identificacao do pagador",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"transaction_date": new Date('2024-08-12T00:00:00Z'),
"description": "VENDA PETR4 100 UN",
"amount": 3550.0,
"direction": "credit",
"ai_category": "Venda de acoes",
"ir_field": "renda_variavel_operacoes_comuns",
"ir_form": "Renda Variavel",
"taxation_type": "tributavel",
"confidence_score": 90,
"reviewed_by_user": true,
"requires_human_review": false,
"review_reason": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"transaction_date": new Date('2024-06-03T00:00:00Z'),
"description": "NFS-e Servicos de beleza",
"amount": 1800.0,
"direction": "debit",
"ai_category": "Receita MEI",
"ir_field": "receita_mei",
"ir_form": "Rendimentos Tributaveis Recebidos de PF",
"taxation_type": "nao_tributavel",
"confidence_score": 79,
"reviewed_by_user": false,
"requires_human_review": true,
"review_reason": "Necessita separar parcela isenta do MEI",
// type code here for "relation_one" field
},
];
const DocumentsData = [
{
// type code here for "relation_one" field
"document_type": "informe_rendimentos_empregador",
"file_name": "informe_xpto_2024.pdf",
"storage_url": "https://storage.supabase.example/docs/maria/informe_xpto_2024.pdf",
"extraction_status": "falhou",
"extraction_confidence": 94,
"extracted_data_json": "{rendimentos_tributaveis:100800,ir_retido_fonte:9800,inss_retido:8200}",
"reviewed": true,
"issuer_name": "XPTO Tecnologia LTDA",
"issuer_cnpj": "12.345.678/0001-90",
"reference_year": 2024,
"uploaded_at": new Date('2025-02-18T10:05:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"document_type": "escritura_imovel",
"file_name": "informe_saude_saudebem_2024.pdf",
"storage_url": "https://storage.supabase.example/docs/maria/informe_saude_2024.pdf",
"extraction_status": "falhou",
"extraction_confidence": 90,
"extracted_data_json": "{valor_pago_saude:8160}",
"reviewed": true,
"issuer_name": "SaudeBem Assistencia Medica",
"issuer_cnpj": "11.222.333/0001-44",
"reference_year": 2024,
"uploaded_at": new Date('2025-02-19T12:20:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"document_type": "outro",
"file_name": "mensalidade_escola_pedro_2024.pdf",
"storage_url": "https://storage.supabase.example/docs/maria/escola_pedro_2024.pdf",
"extraction_status": "extraido",
"extraction_confidence": 86,
"extracted_data_json": "{valor_pago_educacao:13200,dependente:Pedro Silva}",
"reviewed": false,
"issuer_name": "Colegio Horizonte",
"issuer_cnpj": "22.333.444/0001-55",
"reference_year": 2024,
"uploaded_at": new Date('2025-02-25T09:15:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"document_type": "informe_saude",
"file_name": "informe_xp_2024.pdf",
"storage_url": "https://storage.supabase.example/docs/carlos/informe_xp_2024.pdf",
"extraction_status": "falhou",
"extraction_confidence": 92,
"extracted_data_json": "{dividendos:2400,jcp:1100}",
"reviewed": true,
"issuer_name": "XP Investimentos",
"issuer_cnpj": "02.332.886/0001-04",
"reference_year": 2024,
"uploaded_at": new Date('2025-03-06T16:10:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"document_type": "dimob",
"file_name": "informe_pgbl_2024.pdf",
"storage_url": "https://storage.supabase.example/docs/beatriz/informe_pgbl_2024.pdf",
"extraction_status": "pendente",
"extraction_confidence": 89,
"extracted_data_json": "{contribuicao_previdencia_privada:9600}",
"reviewed": true,
"issuer_name": "Previdencia Segura SA",
"issuer_cnpj": "33.444.555/0001-66",
"reference_year": 2024,
"uploaded_at": new Date('2025-02-21T14:35:00Z'),
// type code here for "relation_one" field
},
];
const IncomePayersPjData = [
{
// type code here for "relation_one" field
"payer_cnpj": "12.345.678/0001-90",
"payer_name": "XPTO Tecnologia LTDA",
"taxable_income": 100800.0,
"official_deductions": 0.0,
"inss_withheld": 8200.0,
"tax_withheld": 9800.0,
"thirteenth_salary": 8400.0,
"informe_document_url": "https://storage.supabase.example/docs/maria/informe_xpto_2024.pdf",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"payer_cnpj": "23.456.789/0001-10",
"payer_name": "Studio Minas Design LTDA",
"taxable_income": 48000.0,
"official_deductions": 0.0,
"inss_withheld": 4100.0,
"tax_withheld": 2200.0,
"thirteenth_salary": 0.0,
"informe_document_url": "https://storage.supabase.example/docs/carlos/informe_studio_2024.pdf",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"payer_cnpj": "23.456.789/0001-10",
"payer_name": "Studio Minas Design LTDA",
"taxable_income": 46000.0,
"official_deductions": 0.0,
"inss_withheld": 3900.0,
"tax_withheld": 2000.0,
"thirteenth_salary": 0.0,
"informe_document_url": "https://storage.supabase.example/docs/carlos/informe_studio_2023.pdf",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"payer_cnpj": "34.567.890/0001-20",
"payer_name": "Beatriz Santos MEI",
"taxable_income": 68000.0,
"official_deductions": 0.0,
"inss_withheld": 0.0,
"tax_withheld": 0.0,
"thirteenth_salary": 0.0,
"informe_document_url": "https://storage.supabase.example/docs/beatriz/das_mei_2024.pdf",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"payer_cnpj": "12.345.678/0001-90",
"payer_name": "XPTO Tecnologia LTDA",
"taxable_income": 99600.0,
"official_deductions": 0.0,
"inss_withheld": 8000.0,
"tax_withheld": 9100.0,
"thirteenth_salary": 8300.0,
"informe_document_url": "https://storage.supabase.example/docs/maria/informe_xpto_2023.pdf",
// type code here for "relation_one" field
},
];
const IncomeCarneLeaoMonthlyData = [
{
// type code here for "relation_one" field
"year": 2024,
"month": 1,
"gross_revenue": 2400.0,
"bookkeeping_deductions": 350.0,
"taxable_base": 2050.0,
"tax_due": 0.0,
"darf_paid": true,
"darf_document_url": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 2,
"gross_revenue": 2600.0,
"bookkeeping_deductions": 420.0,
"taxable_base": 2180.0,
"tax_due": 0.0,
"darf_paid": false,
"darf_document_url": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 3,
"gross_revenue": 2800.0,
"bookkeeping_deductions": 500.0,
"taxable_base": 2300.0,
"tax_due": 3.06,
"darf_paid": true,
"darf_document_url": "https://storage.supabase.example/docs/carlos/darf_carneleao_2024_03.pdf",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 6,
"gross_revenue": 5800.0,
"bookkeeping_deductions": 600.0,
"taxable_base": 5200.0,
"tax_due": 742.0,
"darf_paid": true,
"darf_document_url": "https://storage.supabase.example/docs/beatriz/darf_carneleao_2024_06.pdf",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 7,
"gross_revenue": 6100.0,
"bookkeeping_deductions": 700.0,
"taxable_base": 5400.0,
"tax_due": 797.0,
"darf_paid": false,
"darf_document_url": "",
// type code here for "relation_one" field
},
];
const ExemptIncomesData = [
{
// type code here for "relation_one" field
"income_type": "lucro_unico_imovel_ate_440k",
"source_name": "XP Investimentos",
"source_document": "02.332.886/0001-04",
"amount": 2400.0,
"competence": "2024",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "lucro_unico_imovel_ate_440k",
"source_name": "Nubank",
"source_document": "18.236.120/0001-58",
"amount": 320.55,
"competence": "2024",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "indenizacao_rescisao",
"source_name": "Caixa Economica Federal",
"source_document": "00.360.305/0001-04",
"amount": 0.0,
"competence": "2024",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "aposentadoria_parcela_isenta_65",
"source_name": "Itau",
"source_document": "60.701.190/0001-04",
"amount": 780.2,
"competence": "2023",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "ganho_acoes_ate_20k_mes",
"source_name": "Banco do Brasil",
"source_document": "00.000.000/0001-91",
"amount": 150.0,
"competence": "2023",
// type code here for "relation_one" field
},
];
const ExclusiveIncomesData = [
{
// type code here for "relation_one" field
"income_type": "previdencia_vgbl",
"source_name": "XPTO Tecnologia LTDA",
"source_document": "12.345.678/0001-90",
"amount": 8400.0,
"tax_withheld": 620.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "jcp",
"source_name": "XP Investimentos",
"source_document": "02.332.886/0001-04",
"amount": 1100.0,
"tax_withheld": 165.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "jcp",
"source_name": "XPTO Tecnologia LTDA",
"source_document": "12.345.678/0001-90",
"amount": 8300.0,
"tax_withheld": 605.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "plr",
"source_name": "Itau",
"source_document": "60.701.190/0001-04",
"amount": 540.0,
"tax_withheld": 81.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"income_type": "premios_loterias",
"source_name": "Previdencia Segura SA",
"source_document": "33.444.555/0001-66",
"amount": 0.0,
"tax_withheld": 0.0,
// type code here for "relation_one" field
},
];
const AssetsData = [
{
// type code here for "relation_one" field
"group_code": "01",
"item_code": "11",
"description_text": "Apartamento para locacao em Salvador BA",
"country": "Brasil",
"registration_number": "IPTU 123456789",
"value_previous_year": 280000.0,
"value_current_year": 280000.0,
"disposed_in_year": false,
"disposal_value": 0.0,
"buyer_document": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"group_code": "04",
"item_code": "72",
"description_text": "Conta investimento em corretora XP",
"country": "Brasil",
"registration_number": "Conta XP 889900",
"value_previous_year": 52000.0,
"value_current_year": 61500.0,
"disposed_in_year": true,
"disposal_value": 0.0,
"buyer_document": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"group_code": "07",
"item_code": "99",
"description_text": "Criptoativos em exchange Mercado Bitcoin",
"country": "Brasil",
"registration_number": "Conta MB 778899",
"value_previous_year": 9000.0,
"value_current_year": 12500.0,
"disposed_in_year": true,
"disposal_value": 0.0,
"buyer_document": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"group_code": "04",
"item_code": "61",
"description_text": "Conta corrente Nubank",
"country": "Brasil",
"registration_number": "Agencia 0001 Conta 12345678",
"value_previous_year": 3500.0,
"value_current_year": 4200.0,
"disposed_in_year": true,
"disposal_value": 0.0,
"buyer_document": "",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"group_code": "04",
"item_code": "61",
"description_text": "Conta corrente Nubank",
"country": "Brasil",
"registration_number": "Agencia 0001 Conta 12345678",
"value_previous_year": 2800.0,
"value_current_year": 3500.0,
"disposed_in_year": false,
"disposal_value": 0.0,
"buyer_document": "",
// type code here for "relation_one" field
},
];
const DebtsData = [
{
// type code here for "relation_one" field
"debt_code": "11",
"creditor_name": "Banco Inter",
"creditor_document": "00.416.968/0001-01",
"description_text": "Financiamento imobiliario do apartamento locado",
"balance_previous_year": 185000.0,
"balance_current_year": 176500.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"debt_code": "12",
"creditor_name": "Itau Unibanco",
"creditor_document": "60.701.190/0001-04",
"description_text": "Emprestimo pessoal contratado em 2024",
"balance_previous_year": 0.0,
"balance_current_year": 8200.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"debt_code": "13",
"creditor_name": "Santander",
"creditor_document": "90.400.888/0001-42",
"description_text": "Financiamento de veiculo",
"balance_previous_year": 22000.0,
"balance_current_year": 14500.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"debt_code": "13",
"creditor_name": "Santander",
"creditor_document": "90.400.888/0001-42",
"description_text": "Financiamento de veiculo",
"balance_previous_year": 28500.0,
"balance_current_year": 22000.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"debt_code": "12",
"creditor_name": "Itau Unibanco",
"creditor_document": "60.701.190/0001-04",
"description_text": "Cartao e credito rotativo regularizado",
"balance_previous_year": 1200.0,
"balance_current_year": 0.0,
// type code here for "relation_one" field
},
];
const DeductiblePaymentsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"payment_code": "22",
"beneficiary_name": "Colegio Horizonte",
"beneficiary_document": "22.333.444/0001-55",
"amount_paid": 3561.5,
"notes": "Limite anual aplicado para educacao do dependente",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"payment_code": "22",
"beneficiary_name": "Colegio Horizonte",
"beneficiary_document": "22.333.444/0001-55",
"amount_paid": 3561.5,
"notes": "Limite anual aplicado para educacao do dependente",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"payment_code": "03",
"beneficiary_name": "SaudeBem Assistencia Medica",
"beneficiary_document": "11.222.333/0001-44",
"amount_paid": 8160.0,
"notes": "Plano de saude familiar",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"payment_code": "01",
"beneficiary_name": "Clinica Odonto Centro",
"beneficiary_document": "44.555.666/0001-77",
"amount_paid": 950.0,
"notes": "Despesa odontologica com recibo",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"payment_code": "26",
"beneficiary_name": "Previdencia Segura SA",
"beneficiary_document": "33.444.555/0001-66",
"amount_paid": 9600.0,
"notes": "Contribuicao PGBL",
// type code here for "relation_one" field
},
];
const InvestmentPositionsData = [
{
// type code here for "relation_one" field
"ticker": "PETR4",
"asset_name": "Petrobras PN",
"asset_type": "renda_fixa",
"brokerage_name": "XP Investimentos",
"quantity": 250.0,
"avg_cost": 31.5,
"value_previous_year": 7200.0,
"value_current_year": 8600.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"ticker": "VALE3",
"asset_name": "Vale ON",
"asset_type": "bdr",
"brokerage_name": "XP Investimentos",
"quantity": 120.0,
"avg_cost": 63.2,
"value_previous_year": 6800.0,
"value_current_year": 7550.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"ticker": "HGLG11",
"asset_name": "FII CSHG Logistica",
"asset_type": "renda_fixa",
"brokerage_name": "XP Investimentos",
"quantity": 80.0,
"avg_cost": 160.0,
"value_previous_year": 12000.0,
"value_current_year": 13200.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"ticker": "BTC",
"asset_name": "Bitcoin",
"asset_type": "bdr",
"brokerage_name": "Mercado Bitcoin",
"quantity": 0.12,
"avg_cost": 150000.0,
"value_previous_year": 9000.0,
"value_current_year": 11000.0,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"ticker": "ETH",
"asset_name": "Ethereum",
"asset_type": "acao_br",
"brokerage_name": "Mercado Bitcoin",
"quantity": 1.8,
"avg_cost": 9000.0,
"value_previous_year": 0.0,
"value_current_year": 1500.0,
// type code here for "relation_one" field
},
];
const TradesData = [
{
// type code here for "relation_one" field
"trade_date": new Date('2024-02-10T00:00:00Z'),
"ticker": "PETR4",
"operation": "buy",
"quantity": 100.0,
"unit_price": 30.2,
"fees": 8.5,
"ir_operation_type": "renda_fixa",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"trade_date": new Date('2024-05-22T00:00:00Z'),
"ticker": "VALE3",
"operation": "sell",
"quantity": 50.0,
"unit_price": 69.5,
"fees": 9.2,
"ir_operation_type": "fii",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"trade_date": new Date('2024-08-12T00:00:00Z'),
"ticker": "PETR4",
"operation": "sell",
"quantity": 100.0,
"unit_price": 35.5,
"fees": 10.0,
"ir_operation_type": "comum",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"trade_date": new Date('2024-09-18T00:00:00Z'),
"ticker": "HGLG11",
"operation": "buy",
"quantity": 20.0,
"unit_price": 165.0,
"fees": 8.8,
"ir_operation_type": "renda_fixa",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"trade_date": new Date('2024-11-05T00:00:00Z'),
"ticker": "PETR4",
"operation": "buy",
"quantity": 50.0,
"unit_price": 33.1,
"fees": 7.9,
"ir_operation_type": "day_trade",
// type code here for "relation_one" field
},
];
const MonthlyCapitalGainsData = [
{
// type code here for "relation_one" field
"year": 2024,
"month": 5,
"asset_type": "etfs",
"gross_gain": 420.0,
"gross_loss": 0.0,
"carryforward_loss": 0.0,
"net_gain": 420.0,
"tax_rate": 0.0,
"tax_due": 0.0,
"darf_paid": true,
"darf_code": "6015",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 8,
"asset_type": "etfs",
"gross_gain": 610.0,
"gross_loss": 0.0,
"carryforward_loss": 0.0,
"net_gain": 610.0,
"tax_rate": 0.0,
"tax_due": 0.0,
"darf_paid": true,
"darf_code": "6015",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 9,
"asset_type": "acoes",
"gross_gain": 0.0,
"gross_loss": 120.0,
"carryforward_loss": 120.0,
"net_gain": 0.0,
"tax_rate": 0.2,
"tax_due": 0.0,
"darf_paid": true,
"darf_code": "6015",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2023,
"month": 10,
"asset_type": "exterior",
"gross_gain": 900.0,
"gross_loss": 0.0,
"carryforward_loss": 0.0,
"net_gain": 900.0,
"tax_rate": 0.0,
"tax_due": 0.0,
"darf_paid": false,
"darf_code": "6015",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"year": 2024,
"month": 12,
"asset_type": "fiis",
"gross_gain": 0.0,
"gross_loss": 0.0,
"carryforward_loss": 0.0,
"net_gain": 0.0,
"tax_rate": 0.15,
"tax_due": 0.0,
"darf_paid": true,
"darf_code": "0190",
// type code here for "relation_one" field
},
];
const RiskAnalysesData = [
{
// type code here for "relation_one" field
"overall_score": 18,
"factors_json": "{high:[],medium:[Dependente com CPF valido],low:[INSS conferido]}",
"optimization_suggestions_json": "{tips:[Verificar PGBL se aplicavel]}",
"analyzed_at": new Date('2025-04-15T13:30:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"overall_score": 22,
"factors_json": "{high:[],medium:[],low:[Conta bancaria informada]}",
"optimization_suggestions_json": "{tips:[Revisar despesas educacao no limite]}",
"analyzed_at": new Date('2024-04-20T15:20:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"overall_score": 54,
"factors_json": "{high:[],medium:[Deducao sem CPF do recebedor],low:[]}",
"optimization_suggestions_json": "{tips:[Organizar recibos de saude e identificar pagadores do freelance]}",
"analyzed_at": new Date('2025-03-28T10:10:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"overall_score": 41,
"factors_json": "{high:[],medium:[Variacao mensal de renda],low:[]}",
"optimization_suggestions_json": "{tips:[Separar receitas de PF e PJ para carne-leao]}",
"analyzed_at": new Date('2024-04-27T18:10:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"overall_score": 29,
"factors_json": "{high:[],medium:[],low:[Aluguel consistente com imovel declarado]}",
"optimization_suggestions_json": "{tips:[Avaliar doacoes incentivadas no limite permitido]}",
"analyzed_at": new Date('2025-04-10T11:20:00Z'),
// type code here for "relation_one" field
},
];
const NotificationsData = [
{
// type code here for "relation_one" field
"notification_type": "success",
"title_text": "Informe importado com sucesso",
"message_text": "Seu informe de rendimentos do empregador foi importado e confirmado.",
"read": true,
"sent_at": new Date('2025-02-18T10:30:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "error",
"title_text": "Transacoes aguardam revisao",
"message_text": "Ha 3 transacoes com baixa confianca que precisam de confirmacao.",
"read": false,
"sent_at": new Date('2025-03-02T09:10:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "warning",
"title_text": "NF-e importadas",
"message_text": "Importamos 42 notas emitidas e 8 recebidas da SEFAZ BA.",
"read": true,
"sent_at": new Date('2025-02-28T13:40:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "success",
"title_text": "Prazo da declaracao",
"message_text": "Faltam 15 dias para o prazo de entrega. Verifique pendencias.",
"read": false,
"sent_at": new Date('2025-04-15T08:00:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"notification_type": "info",
"title_text": "Inconsistencia detectada",
"message_text": "Detectamos deducao medica sem CPF/CNPJ do prestador. Revise em Pagamentos.",
"read": true,
"sent_at": new Date('2025-03-28T10:25:00Z'),
// type code here for "relation_one" field
},
];
const OrganizationMembershipsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"member_role": "owner",
"active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"member_role": "member",
"active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"member_role": "contador",
"active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"member_role": "contador",
"active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"member_role": "owner",
"active": true,
},
];
const AccountantClientAccessesData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "aguardando_revisao_contador",
"access_granted": true,
"granted_at": new Date('2025-02-15T09:00:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "aguardando_revisao_contador",
"access_granted": true,
"granted_at": new Date('2025-02-16T10:00:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "problemas_identificados",
"access_granted": true,
"granted_at": new Date('2025-03-01T08:00:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "aguardando_revisao_contador",
"access_granted": true,
"granted_at": new Date('2024-02-20T08:00:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "aguardando_dados",
"access_granted": true,
"granted_at": new Date('2025-03-10T12:00:00Z'),
// type code here for "relation_one" field
},
];
const AuditLogsData = [
{
// type code here for "relation_one" field
"event_type": "declaration_update",
"entity_name": "documents",
"entity_key": "informe_xpto_2024.pdf",
"ip_address": "189.10.20.30",
"user_agent": "Mozilla/5.0 Chrome",
"details_json": "{file:informe_xpto_2024.pdf}",
"event_at": new Date('2025-02-18T10:05:10Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"event_type": "auth_logout",
"entity_name": "transactions",
"entity_key": "PIX RECEBIDO FREELANCE DESIGN",
"ip_address": "200.150.10.5",
"user_agent": "Mozilla/5.0 Safari",
"details_json": "{confidence:82,requires_review:true}",
"event_at": new Date('2025-03-15T14:20:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"event_type": "export_pdf",
"entity_name": "user_profiles",
"entity_key": "345.678.901-23",
"ip_address": "177.50.40.3",
"user_agent": "Mozilla/5.0 Firefox",
"details_json": "{field:address}",
"event_at": new Date('2025-02-12T09:40:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"event_type": "account_delete",
"entity_name": "accountant_client_accesses",
"entity_key": "Ana Souza -> Maria Silva",
"ip_address": "201.2.3.4",
"user_agent": "Mozilla/5.0 Chrome",
"details_json": "{access_granted:true}",
"event_at": new Date('2025-02-15T09:00:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"event_type": "declaration_update",
"entity_name": "declarations",
"entity_key": "Maria Silva 2023",
"ip_address": "187.60.70.80",
"user_agent": "Mozilla/5.0 Chrome",
"details_json": "{year:2023}",
"event_at": new Date('2024-04-20T16:00:00Z'),
// type code here for "relation_one" field
},
];
const ConsentsData = [
{
// type code here for "relation_one" field
"consent_type": "cookies",
"version": "2025-01",
"granted": true,
"granted_at": new Date('2025-02-10T18:00:00Z'),
"context_json": "{source:onboarding}",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"consent_type": "privacy_policy",
"version": "2025-01",
"granted": true,
"granted_at": new Date('2025-02-10T18:00:05Z'),
"context_json": "{source:signup}",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"consent_type": "lgpd_processing",
"version": "2025-01",
"granted": true,
"granted_at": new Date('2025-02-12T20:00:00Z'),
"context_json": "{source:signup}",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"consent_type": "cookies",
"version": "2025-01",
"granted": true,
"granted_at": new Date('2025-02-14T11:00:00Z'),
"context_json": "{source:website}",
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"consent_type": "terms_of_use",
"version": "2025-01",
"granted": true,
"granted_at": new Date('2025-01-20T12:00:00Z'),
"context_json": "{source:internal}",
// type code here for "relation_one" field
},
];
const JobRunsData = [
{
// type code here for "relation_one" field
"job_type": "sefaz_import",
"status": "succeeded",
"attempt": 1,
"input_json": "{document:informe_xpto_2024.pdf}",
"output_json": "{fields:12}",
"error_message": "",
"started_at": new Date('2025-02-18T10:06:00Z'),
"finished_at": new Date('2025-02-18T10:06:40Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"job_type": "pdf_generation",
"status": "canceled",
"attempt": 1,
"input_json": "{transactions:847}",
"output_json": "{classified:820,needs_review:27}",
"error_message": "",
"started_at": new Date('2025-02-22T11:31:00Z'),
"finished_at": new Date('2025-02-22T11:36:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"job_type": "brokerage_import",
"status": "canceled",
"attempt": 1,
"input_json": "{broker:XP Investimentos}",
"output_json": "{positions:12,trades:58}",
"error_message": "",
"started_at": new Date('2025-03-05T15:40:00Z'),
"finished_at": new Date('2025-03-05T15:42:30Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"job_type": "ai_classification_batch",
"status": "succeeded",
"attempt": 2,
"input_json": "{state:BA}",
"output_json": "{nfe_emitidas:42}",
"error_message": "timeout na primeira tentativa",
"started_at": new Date('2025-02-28T13:20:00Z'),
"finished_at": new Date('2025-02-28T13:25:00Z'),
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
"job_type": "sefaz_import",
"status": "failed",
"attempt": 1,
"input_json": "{base_year:2024}",
"output_json": "{}",
"error_message": "",
"started_at": new Date('2025-03-28T10:12:00Z'),
"finished_at": new Date('2020-01-01T00:00:00Z'),
// type code here for "relation_one" field
},
];
// Similar logic for "relation_many"
async function associateUserWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User0 = await Users.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (User0?.setOrganization)
{
await
User0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User1 = await Users.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (User1?.setOrganization)
{
await
User1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User2 = await Users.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (User2?.setOrganization)
{
await
User2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User3 = await Users.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (User3?.setOrganization)
{
await
User3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User4 = await Users.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (User4?.setOrganization)
{
await
User4.
setOrganization(relatedOrganization4);
}
}
async function associateUserProfileWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfile0 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (UserProfile0?.setUser)
{
await
UserProfile0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfile1 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (UserProfile1?.setUser)
{
await
UserProfile1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfile2 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (UserProfile2?.setUser)
{
await
UserProfile2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfile3 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (UserProfile3?.setUser)
{
await
UserProfile3.
setUser(relatedUser3);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfile4 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (UserProfile4?.setUser)
{
await
UserProfile4.
setUser(relatedUser4);
}
}
async function associateUserProfileWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfile0 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (UserProfile0?.setOrganization)
{
await
UserProfile0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfile1 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (UserProfile1?.setOrganization)
{
await
UserProfile1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfile2 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (UserProfile2?.setOrganization)
{
await
UserProfile2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfile3 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (UserProfile3?.setOrganization)
{
await
UserProfile3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfile4 = await UserProfiles.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (UserProfile4?.setOrganization)
{
await
UserProfile4.
setOrganization(relatedOrganization4);
}
}
async function associateUserProfileTypeWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfileType0 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (UserProfileType0?.setUser)
{
await
UserProfileType0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfileType1 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (UserProfileType1?.setUser)
{
await
UserProfileType1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfileType2 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (UserProfileType2?.setUser)
{
await
UserProfileType2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfileType3 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (UserProfileType3?.setUser)
{
await
UserProfileType3.
setUser(relatedUser3);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const UserProfileType4 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (UserProfileType4?.setUser)
{
await
UserProfileType4.
setUser(relatedUser4);
}
}
async function associateUserProfileTypeWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfileType0 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (UserProfileType0?.setOrganization)
{
await
UserProfileType0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfileType1 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (UserProfileType1?.setOrganization)
{
await
UserProfileType1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfileType2 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (UserProfileType2?.setOrganization)
{
await
UserProfileType2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfileType3 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (UserProfileType3?.setOrganization)
{
await
UserProfileType3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const UserProfileType4 = await UserProfileTypes.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (UserProfileType4?.setOrganization)
{
await
UserProfileType4.
setOrganization(relatedOrganization4);
}
}
async function associateDeclarationWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Declaration0 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Declaration0?.setUser)
{
await
Declaration0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Declaration1 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Declaration1?.setUser)
{
await
Declaration1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Declaration2 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Declaration2?.setUser)
{
await
Declaration2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Declaration3 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Declaration3?.setUser)
{
await
Declaration3.
setUser(relatedUser3);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Declaration4 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Declaration4?.setUser)
{
await
Declaration4.
setUser(relatedUser4);
}
}
async function associateDeclarationWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Declaration0 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Declaration0?.setOrganization)
{
await
Declaration0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Declaration1 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Declaration1?.setOrganization)
{
await
Declaration1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Declaration2 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Declaration2?.setOrganization)
{
await
Declaration2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Declaration3 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Declaration3?.setOrganization)
{
await
Declaration3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Declaration4 = await Declarations.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Declaration4?.setOrganization)
{
await
Declaration4.
setOrganization(relatedOrganization4);
}
}
async function associateDependentWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Dependent0 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Dependent0?.setDeclaration)
{
await
Dependent0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Dependent1 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Dependent1?.setDeclaration)
{
await
Dependent1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Dependent2 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Dependent2?.setDeclaration)
{
await
Dependent2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Dependent3 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Dependent3?.setDeclaration)
{
await
Dependent3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Dependent4 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Dependent4?.setDeclaration)
{
await
Dependent4.
setDeclaration(relatedDeclaration4);
}
}
async function associateDependentWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Dependent0 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Dependent0?.setOrganization)
{
await
Dependent0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Dependent1 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Dependent1?.setOrganization)
{
await
Dependent1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Dependent2 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Dependent2?.setOrganization)
{
await
Dependent2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Dependent3 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Dependent3?.setOrganization)
{
await
Dependent3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Dependent4 = await Dependents.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Dependent4?.setOrganization)
{
await
Dependent4.
setOrganization(relatedOrganization4);
}
}
async function associateDataSourceWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DataSource0 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (DataSource0?.setDeclaration)
{
await
DataSource0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DataSource1 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (DataSource1?.setDeclaration)
{
await
DataSource1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DataSource2 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (DataSource2?.setDeclaration)
{
await
DataSource2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DataSource3 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (DataSource3?.setDeclaration)
{
await
DataSource3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DataSource4 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (DataSource4?.setDeclaration)
{
await
DataSource4.
setDeclaration(relatedDeclaration4);
}
}
async function associateDataSourceWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DataSource0 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (DataSource0?.setOrganization)
{
await
DataSource0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DataSource1 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (DataSource1?.setOrganization)
{
await
DataSource1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DataSource2 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (DataSource2?.setOrganization)
{
await
DataSource2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DataSource3 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (DataSource3?.setOrganization)
{
await
DataSource3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DataSource4 = await DataSources.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (DataSource4?.setOrganization)
{
await
DataSource4.
setOrganization(relatedOrganization4);
}
}
async function associateTransactionWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Transaction0 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Transaction0?.setDeclaration)
{
await
Transaction0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Transaction1 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Transaction1?.setDeclaration)
{
await
Transaction1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Transaction2 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Transaction2?.setDeclaration)
{
await
Transaction2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Transaction3 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Transaction3?.setDeclaration)
{
await
Transaction3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Transaction4 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Transaction4?.setDeclaration)
{
await
Transaction4.
setDeclaration(relatedDeclaration4);
}
}
async function associateTransactionWithData_source() {
const relatedData_source0 = await DataSources.findOne({
offset: Math.floor(Math.random() * (await DataSources.count())),
});
const Transaction0 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Transaction0?.setData_source)
{
await
Transaction0.
setData_source(relatedData_source0);
}
const relatedData_source1 = await DataSources.findOne({
offset: Math.floor(Math.random() * (await DataSources.count())),
});
const Transaction1 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Transaction1?.setData_source)
{
await
Transaction1.
setData_source(relatedData_source1);
}
const relatedData_source2 = await DataSources.findOne({
offset: Math.floor(Math.random() * (await DataSources.count())),
});
const Transaction2 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Transaction2?.setData_source)
{
await
Transaction2.
setData_source(relatedData_source2);
}
const relatedData_source3 = await DataSources.findOne({
offset: Math.floor(Math.random() * (await DataSources.count())),
});
const Transaction3 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Transaction3?.setData_source)
{
await
Transaction3.
setData_source(relatedData_source3);
}
const relatedData_source4 = await DataSources.findOne({
offset: Math.floor(Math.random() * (await DataSources.count())),
});
const Transaction4 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Transaction4?.setData_source)
{
await
Transaction4.
setData_source(relatedData_source4);
}
}
async function associateTransactionWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Transaction0 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Transaction0?.setOrganization)
{
await
Transaction0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Transaction1 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Transaction1?.setOrganization)
{
await
Transaction1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Transaction2 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Transaction2?.setOrganization)
{
await
Transaction2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Transaction3 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Transaction3?.setOrganization)
{
await
Transaction3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Transaction4 = await Transactions.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Transaction4?.setOrganization)
{
await
Transaction4.
setOrganization(relatedOrganization4);
}
}
async function associateDocumentWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Document0 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Document0?.setDeclaration)
{
await
Document0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Document1 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Document1?.setDeclaration)
{
await
Document1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Document2 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Document2?.setDeclaration)
{
await
Document2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Document3 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Document3?.setDeclaration)
{
await
Document3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Document4 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Document4?.setDeclaration)
{
await
Document4.
setDeclaration(relatedDeclaration4);
}
}
async function associateDocumentWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Document0 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Document0?.setOrganization)
{
await
Document0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Document1 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Document1?.setOrganization)
{
await
Document1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Document2 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Document2?.setOrganization)
{
await
Document2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Document3 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Document3?.setOrganization)
{
await
Document3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Document4 = await Documents.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Document4?.setOrganization)
{
await
Document4.
setOrganization(relatedOrganization4);
}
}
async function associateIncomePayersPjWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomePayersPj0 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (IncomePayersPj0?.setDeclaration)
{
await
IncomePayersPj0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomePayersPj1 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (IncomePayersPj1?.setDeclaration)
{
await
IncomePayersPj1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomePayersPj2 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (IncomePayersPj2?.setDeclaration)
{
await
IncomePayersPj2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomePayersPj3 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (IncomePayersPj3?.setDeclaration)
{
await
IncomePayersPj3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomePayersPj4 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (IncomePayersPj4?.setDeclaration)
{
await
IncomePayersPj4.
setDeclaration(relatedDeclaration4);
}
}
async function associateIncomePayersPjWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomePayersPj0 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (IncomePayersPj0?.setOrganization)
{
await
IncomePayersPj0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomePayersPj1 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (IncomePayersPj1?.setOrganization)
{
await
IncomePayersPj1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomePayersPj2 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (IncomePayersPj2?.setOrganization)
{
await
IncomePayersPj2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomePayersPj3 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (IncomePayersPj3?.setOrganization)
{
await
IncomePayersPj3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomePayersPj4 = await IncomePayersPj.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (IncomePayersPj4?.setOrganization)
{
await
IncomePayersPj4.
setOrganization(relatedOrganization4);
}
}
async function associateIncomeCarneLeaoMonthlyWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomeCarneLeaoMonthly0 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (IncomeCarneLeaoMonthly0?.setDeclaration)
{
await
IncomeCarneLeaoMonthly0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomeCarneLeaoMonthly1 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (IncomeCarneLeaoMonthly1?.setDeclaration)
{
await
IncomeCarneLeaoMonthly1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomeCarneLeaoMonthly2 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (IncomeCarneLeaoMonthly2?.setDeclaration)
{
await
IncomeCarneLeaoMonthly2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomeCarneLeaoMonthly3 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (IncomeCarneLeaoMonthly3?.setDeclaration)
{
await
IncomeCarneLeaoMonthly3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const IncomeCarneLeaoMonthly4 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (IncomeCarneLeaoMonthly4?.setDeclaration)
{
await
IncomeCarneLeaoMonthly4.
setDeclaration(relatedDeclaration4);
}
}
async function associateIncomeCarneLeaoMonthlyWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomeCarneLeaoMonthly0 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (IncomeCarneLeaoMonthly0?.setOrganization)
{
await
IncomeCarneLeaoMonthly0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomeCarneLeaoMonthly1 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (IncomeCarneLeaoMonthly1?.setOrganization)
{
await
IncomeCarneLeaoMonthly1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomeCarneLeaoMonthly2 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (IncomeCarneLeaoMonthly2?.setOrganization)
{
await
IncomeCarneLeaoMonthly2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomeCarneLeaoMonthly3 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (IncomeCarneLeaoMonthly3?.setOrganization)
{
await
IncomeCarneLeaoMonthly3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const IncomeCarneLeaoMonthly4 = await IncomeCarneLeaoMonthly.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (IncomeCarneLeaoMonthly4?.setOrganization)
{
await
IncomeCarneLeaoMonthly4.
setOrganization(relatedOrganization4);
}
}
async function associateExemptIncomeWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExemptIncome0 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ExemptIncome0?.setDeclaration)
{
await
ExemptIncome0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExemptIncome1 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ExemptIncome1?.setDeclaration)
{
await
ExemptIncome1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExemptIncome2 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ExemptIncome2?.setDeclaration)
{
await
ExemptIncome2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExemptIncome3 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ExemptIncome3?.setDeclaration)
{
await
ExemptIncome3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExemptIncome4 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (ExemptIncome4?.setDeclaration)
{
await
ExemptIncome4.
setDeclaration(relatedDeclaration4);
}
}
async function associateExemptIncomeWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExemptIncome0 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ExemptIncome0?.setOrganization)
{
await
ExemptIncome0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExemptIncome1 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ExemptIncome1?.setOrganization)
{
await
ExemptIncome1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExemptIncome2 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ExemptIncome2?.setOrganization)
{
await
ExemptIncome2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExemptIncome3 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ExemptIncome3?.setOrganization)
{
await
ExemptIncome3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExemptIncome4 = await ExemptIncomes.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (ExemptIncome4?.setOrganization)
{
await
ExemptIncome4.
setOrganization(relatedOrganization4);
}
}
async function associateExclusiveIncomeWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExclusiveIncome0 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ExclusiveIncome0?.setDeclaration)
{
await
ExclusiveIncome0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExclusiveIncome1 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ExclusiveIncome1?.setDeclaration)
{
await
ExclusiveIncome1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExclusiveIncome2 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ExclusiveIncome2?.setDeclaration)
{
await
ExclusiveIncome2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExclusiveIncome3 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ExclusiveIncome3?.setDeclaration)
{
await
ExclusiveIncome3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const ExclusiveIncome4 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (ExclusiveIncome4?.setDeclaration)
{
await
ExclusiveIncome4.
setDeclaration(relatedDeclaration4);
}
}
async function associateExclusiveIncomeWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExclusiveIncome0 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ExclusiveIncome0?.setOrganization)
{
await
ExclusiveIncome0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExclusiveIncome1 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ExclusiveIncome1?.setOrganization)
{
await
ExclusiveIncome1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExclusiveIncome2 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ExclusiveIncome2?.setOrganization)
{
await
ExclusiveIncome2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExclusiveIncome3 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ExclusiveIncome3?.setOrganization)
{
await
ExclusiveIncome3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const ExclusiveIncome4 = await ExclusiveIncomes.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (ExclusiveIncome4?.setOrganization)
{
await
ExclusiveIncome4.
setOrganization(relatedOrganization4);
}
}
async function associateAssetWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Asset0 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Asset0?.setDeclaration)
{
await
Asset0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Asset1 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Asset1?.setDeclaration)
{
await
Asset1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Asset2 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Asset2?.setDeclaration)
{
await
Asset2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Asset3 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Asset3?.setDeclaration)
{
await
Asset3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Asset4 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Asset4?.setDeclaration)
{
await
Asset4.
setDeclaration(relatedDeclaration4);
}
}
async function associateAssetWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Asset0 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Asset0?.setOrganization)
{
await
Asset0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Asset1 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Asset1?.setOrganization)
{
await
Asset1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Asset2 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Asset2?.setOrganization)
{
await
Asset2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Asset3 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Asset3?.setOrganization)
{
await
Asset3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Asset4 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Asset4?.setOrganization)
{
await
Asset4.
setOrganization(relatedOrganization4);
}
}
async function associateDebtWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Debt0 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Debt0?.setDeclaration)
{
await
Debt0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Debt1 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Debt1?.setDeclaration)
{
await
Debt1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Debt2 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Debt2?.setDeclaration)
{
await
Debt2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Debt3 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Debt3?.setDeclaration)
{
await
Debt3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Debt4 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Debt4?.setDeclaration)
{
await
Debt4.
setDeclaration(relatedDeclaration4);
}
}
async function associateDebtWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Debt0 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Debt0?.setOrganization)
{
await
Debt0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Debt1 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Debt1?.setOrganization)
{
await
Debt1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Debt2 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Debt2?.setOrganization)
{
await
Debt2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Debt3 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Debt3?.setOrganization)
{
await
Debt3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Debt4 = await Debts.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Debt4?.setOrganization)
{
await
Debt4.
setOrganization(relatedOrganization4);
}
}
async function associateDeductiblePaymentWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DeductiblePayment0 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (DeductiblePayment0?.setDeclaration)
{
await
DeductiblePayment0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DeductiblePayment1 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (DeductiblePayment1?.setDeclaration)
{
await
DeductiblePayment1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DeductiblePayment2 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (DeductiblePayment2?.setDeclaration)
{
await
DeductiblePayment2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DeductiblePayment3 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (DeductiblePayment3?.setDeclaration)
{
await
DeductiblePayment3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const DeductiblePayment4 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (DeductiblePayment4?.setDeclaration)
{
await
DeductiblePayment4.
setDeclaration(relatedDeclaration4);
}
}
async function associateDeductiblePaymentWithDependent() {
const relatedDependent0 = await Dependents.findOne({
offset: Math.floor(Math.random() * (await Dependents.count())),
});
const DeductiblePayment0 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (DeductiblePayment0?.setDependent)
{
await
DeductiblePayment0.
setDependent(relatedDependent0);
}
const relatedDependent1 = await Dependents.findOne({
offset: Math.floor(Math.random() * (await Dependents.count())),
});
const DeductiblePayment1 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (DeductiblePayment1?.setDependent)
{
await
DeductiblePayment1.
setDependent(relatedDependent1);
}
const relatedDependent2 = await Dependents.findOne({
offset: Math.floor(Math.random() * (await Dependents.count())),
});
const DeductiblePayment2 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (DeductiblePayment2?.setDependent)
{
await
DeductiblePayment2.
setDependent(relatedDependent2);
}
const relatedDependent3 = await Dependents.findOne({
offset: Math.floor(Math.random() * (await Dependents.count())),
});
const DeductiblePayment3 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (DeductiblePayment3?.setDependent)
{
await
DeductiblePayment3.
setDependent(relatedDependent3);
}
const relatedDependent4 = await Dependents.findOne({
offset: Math.floor(Math.random() * (await Dependents.count())),
});
const DeductiblePayment4 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (DeductiblePayment4?.setDependent)
{
await
DeductiblePayment4.
setDependent(relatedDependent4);
}
}
async function associateDeductiblePaymentWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DeductiblePayment0 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (DeductiblePayment0?.setOrganization)
{
await
DeductiblePayment0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DeductiblePayment1 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (DeductiblePayment1?.setOrganization)
{
await
DeductiblePayment1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DeductiblePayment2 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (DeductiblePayment2?.setOrganization)
{
await
DeductiblePayment2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DeductiblePayment3 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (DeductiblePayment3?.setOrganization)
{
await
DeductiblePayment3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const DeductiblePayment4 = await DeductiblePayments.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (DeductiblePayment4?.setOrganization)
{
await
DeductiblePayment4.
setOrganization(relatedOrganization4);
}
}
async function associateInvestmentPositionWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const InvestmentPosition0 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (InvestmentPosition0?.setDeclaration)
{
await
InvestmentPosition0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const InvestmentPosition1 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (InvestmentPosition1?.setDeclaration)
{
await
InvestmentPosition1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const InvestmentPosition2 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (InvestmentPosition2?.setDeclaration)
{
await
InvestmentPosition2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const InvestmentPosition3 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (InvestmentPosition3?.setDeclaration)
{
await
InvestmentPosition3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const InvestmentPosition4 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (InvestmentPosition4?.setDeclaration)
{
await
InvestmentPosition4.
setDeclaration(relatedDeclaration4);
}
}
async function associateInvestmentPositionWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const InvestmentPosition0 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (InvestmentPosition0?.setOrganization)
{
await
InvestmentPosition0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const InvestmentPosition1 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (InvestmentPosition1?.setOrganization)
{
await
InvestmentPosition1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const InvestmentPosition2 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (InvestmentPosition2?.setOrganization)
{
await
InvestmentPosition2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const InvestmentPosition3 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (InvestmentPosition3?.setOrganization)
{
await
InvestmentPosition3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const InvestmentPosition4 = await InvestmentPositions.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (InvestmentPosition4?.setOrganization)
{
await
InvestmentPosition4.
setOrganization(relatedOrganization4);
}
}
async function associateTradeWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Trade0 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Trade0?.setDeclaration)
{
await
Trade0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Trade1 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Trade1?.setDeclaration)
{
await
Trade1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Trade2 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Trade2?.setDeclaration)
{
await
Trade2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Trade3 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Trade3?.setDeclaration)
{
await
Trade3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const Trade4 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Trade4?.setDeclaration)
{
await
Trade4.
setDeclaration(relatedDeclaration4);
}
}
async function associateTradeWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Trade0 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Trade0?.setOrganization)
{
await
Trade0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Trade1 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Trade1?.setOrganization)
{
await
Trade1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Trade2 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Trade2?.setOrganization)
{
await
Trade2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Trade3 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Trade3?.setOrganization)
{
await
Trade3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Trade4 = await Trades.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Trade4?.setOrganization)
{
await
Trade4.
setOrganization(relatedOrganization4);
}
}
async function associateMonthlyCapitalGainWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const MonthlyCapitalGain0 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (MonthlyCapitalGain0?.setDeclaration)
{
await
MonthlyCapitalGain0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const MonthlyCapitalGain1 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (MonthlyCapitalGain1?.setDeclaration)
{
await
MonthlyCapitalGain1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const MonthlyCapitalGain2 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (MonthlyCapitalGain2?.setDeclaration)
{
await
MonthlyCapitalGain2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const MonthlyCapitalGain3 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (MonthlyCapitalGain3?.setDeclaration)
{
await
MonthlyCapitalGain3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const MonthlyCapitalGain4 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (MonthlyCapitalGain4?.setDeclaration)
{
await
MonthlyCapitalGain4.
setDeclaration(relatedDeclaration4);
}
}
async function associateMonthlyCapitalGainWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const MonthlyCapitalGain0 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (MonthlyCapitalGain0?.setOrganization)
{
await
MonthlyCapitalGain0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const MonthlyCapitalGain1 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (MonthlyCapitalGain1?.setOrganization)
{
await
MonthlyCapitalGain1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const MonthlyCapitalGain2 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (MonthlyCapitalGain2?.setOrganization)
{
await
MonthlyCapitalGain2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const MonthlyCapitalGain3 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (MonthlyCapitalGain3?.setOrganization)
{
await
MonthlyCapitalGain3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const MonthlyCapitalGain4 = await MonthlyCapitalGains.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (MonthlyCapitalGain4?.setOrganization)
{
await
MonthlyCapitalGain4.
setOrganization(relatedOrganization4);
}
}
async function associateRiskAnalysWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const RiskAnalys0 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (RiskAnalys0?.setDeclaration)
{
await
RiskAnalys0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const RiskAnalys1 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (RiskAnalys1?.setDeclaration)
{
await
RiskAnalys1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const RiskAnalys2 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (RiskAnalys2?.setDeclaration)
{
await
RiskAnalys2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const RiskAnalys3 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (RiskAnalys3?.setDeclaration)
{
await
RiskAnalys3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const RiskAnalys4 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (RiskAnalys4?.setDeclaration)
{
await
RiskAnalys4.
setDeclaration(relatedDeclaration4);
}
}
async function associateRiskAnalysWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const RiskAnalys0 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (RiskAnalys0?.setOrganization)
{
await
RiskAnalys0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const RiskAnalys1 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (RiskAnalys1?.setOrganization)
{
await
RiskAnalys1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const RiskAnalys2 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (RiskAnalys2?.setOrganization)
{
await
RiskAnalys2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const RiskAnalys3 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (RiskAnalys3?.setOrganization)
{
await
RiskAnalys3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const RiskAnalys4 = await RiskAnalyses.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (RiskAnalys4?.setOrganization)
{
await
RiskAnalys4.
setOrganization(relatedOrganization4);
}
}
async function associateNotificationWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setUser)
{
await
Notification0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setUser)
{
await
Notification1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setUser)
{
await
Notification2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setUser)
{
await
Notification3.
setUser(relatedUser3);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Notification4 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Notification4?.setUser)
{
await
Notification4.
setUser(relatedUser4);
}
}
async function associateNotificationWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Notification0 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Notification0?.setOrganization)
{
await
Notification0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Notification1 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Notification1?.setOrganization)
{
await
Notification1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Notification2 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Notification2?.setOrganization)
{
await
Notification2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Notification3 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Notification3?.setOrganization)
{
await
Notification3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Notification4 = await Notifications.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Notification4?.setOrganization)
{
await
Notification4.
setOrganization(relatedOrganization4);
}
}
async function associateOrganizationMembershipWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const OrganizationMembership0 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (OrganizationMembership0?.setOrganization)
{
await
OrganizationMembership0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const OrganizationMembership1 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (OrganizationMembership1?.setOrganization)
{
await
OrganizationMembership1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const OrganizationMembership2 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (OrganizationMembership2?.setOrganization)
{
await
OrganizationMembership2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const OrganizationMembership3 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (OrganizationMembership3?.setOrganization)
{
await
OrganizationMembership3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const OrganizationMembership4 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (OrganizationMembership4?.setOrganization)
{
await
OrganizationMembership4.
setOrganization(relatedOrganization4);
}
}
async function associateOrganizationMembershipWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const OrganizationMembership0 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (OrganizationMembership0?.setUser)
{
await
OrganizationMembership0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const OrganizationMembership1 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (OrganizationMembership1?.setUser)
{
await
OrganizationMembership1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const OrganizationMembership2 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (OrganizationMembership2?.setUser)
{
await
OrganizationMembership2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const OrganizationMembership3 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (OrganizationMembership3?.setUser)
{
await
OrganizationMembership3.
setUser(relatedUser3);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const OrganizationMembership4 = await OrganizationMemberships.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (OrganizationMembership4?.setUser)
{
await
OrganizationMembership4.
setUser(relatedUser4);
}
}
async function associateAccountantClientAccessWithAccountant() {
const relatedAccountant0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess0 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AccountantClientAccess0?.setAccountant)
{
await
AccountantClientAccess0.
setAccountant(relatedAccountant0);
}
const relatedAccountant1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess1 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AccountantClientAccess1?.setAccountant)
{
await
AccountantClientAccess1.
setAccountant(relatedAccountant1);
}
const relatedAccountant2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess2 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AccountantClientAccess2?.setAccountant)
{
await
AccountantClientAccess2.
setAccountant(relatedAccountant2);
}
const relatedAccountant3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess3 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AccountantClientAccess3?.setAccountant)
{
await
AccountantClientAccess3.
setAccountant(relatedAccountant3);
}
const relatedAccountant4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess4 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (AccountantClientAccess4?.setAccountant)
{
await
AccountantClientAccess4.
setAccountant(relatedAccountant4);
}
}
async function associateAccountantClientAccessWithClient() {
const relatedClient0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess0 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AccountantClientAccess0?.setClient)
{
await
AccountantClientAccess0.
setClient(relatedClient0);
}
const relatedClient1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess1 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AccountantClientAccess1?.setClient)
{
await
AccountantClientAccess1.
setClient(relatedClient1);
}
const relatedClient2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess2 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AccountantClientAccess2?.setClient)
{
await
AccountantClientAccess2.
setClient(relatedClient2);
}
const relatedClient3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess3 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AccountantClientAccess3?.setClient)
{
await
AccountantClientAccess3.
setClient(relatedClient3);
}
const relatedClient4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AccountantClientAccess4 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (AccountantClientAccess4?.setClient)
{
await
AccountantClientAccess4.
setClient(relatedClient4);
}
}
async function associateAccountantClientAccessWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AccountantClientAccess0 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AccountantClientAccess0?.setOrganization)
{
await
AccountantClientAccess0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AccountantClientAccess1 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AccountantClientAccess1?.setOrganization)
{
await
AccountantClientAccess1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AccountantClientAccess2 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AccountantClientAccess2?.setOrganization)
{
await
AccountantClientAccess2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AccountantClientAccess3 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AccountantClientAccess3?.setOrganization)
{
await
AccountantClientAccess3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AccountantClientAccess4 = await AccountantClientAccesses.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (AccountantClientAccess4?.setOrganization)
{
await
AccountantClientAccess4.
setOrganization(relatedOrganization4);
}
}
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);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AuditLog4 = await AuditLogs.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (AuditLog4?.setUser)
{
await
AuditLog4.
setUser(relatedUser4);
}
}
async function associateAuditLogWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AuditLog0 = await AuditLogs.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AuditLog0?.setOrganization)
{
await
AuditLog0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AuditLog1 = await AuditLogs.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AuditLog1?.setOrganization)
{
await
AuditLog1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AuditLog2 = await AuditLogs.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AuditLog2?.setOrganization)
{
await
AuditLog2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AuditLog3 = await AuditLogs.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AuditLog3?.setOrganization)
{
await
AuditLog3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const AuditLog4 = await AuditLogs.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (AuditLog4?.setOrganization)
{
await
AuditLog4.
setOrganization(relatedOrganization4);
}
}
async function associateConsentWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Consent0 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Consent0?.setUser)
{
await
Consent0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Consent1 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Consent1?.setUser)
{
await
Consent1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Consent2 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Consent2?.setUser)
{
await
Consent2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Consent3 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Consent3?.setUser)
{
await
Consent3.
setUser(relatedUser3);
}
const relatedUser4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Consent4 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Consent4?.setUser)
{
await
Consent4.
setUser(relatedUser4);
}
}
async function associateConsentWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Consent0 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Consent0?.setOrganization)
{
await
Consent0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Consent1 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Consent1?.setOrganization)
{
await
Consent1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Consent2 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Consent2?.setOrganization)
{
await
Consent2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Consent3 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Consent3?.setOrganization)
{
await
Consent3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Consent4 = await Consents.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (Consent4?.setOrganization)
{
await
Consent4.
setOrganization(relatedOrganization4);
}
}
async function associateJobRunWithDeclaration() {
const relatedDeclaration0 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const JobRun0 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (JobRun0?.setDeclaration)
{
await
JobRun0.
setDeclaration(relatedDeclaration0);
}
const relatedDeclaration1 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const JobRun1 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (JobRun1?.setDeclaration)
{
await
JobRun1.
setDeclaration(relatedDeclaration1);
}
const relatedDeclaration2 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const JobRun2 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (JobRun2?.setDeclaration)
{
await
JobRun2.
setDeclaration(relatedDeclaration2);
}
const relatedDeclaration3 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const JobRun3 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (JobRun3?.setDeclaration)
{
await
JobRun3.
setDeclaration(relatedDeclaration3);
}
const relatedDeclaration4 = await Declarations.findOne({
offset: Math.floor(Math.random() * (await Declarations.count())),
});
const JobRun4 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (JobRun4?.setDeclaration)
{
await
JobRun4.
setDeclaration(relatedDeclaration4);
}
}
async function associateJobRunWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const JobRun0 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (JobRun0?.setOrganization)
{
await
JobRun0.
setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const JobRun1 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (JobRun1?.setOrganization)
{
await
JobRun1.
setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const JobRun2 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (JobRun2?.setOrganization)
{
await
JobRun2.
setOrganization(relatedOrganization2);
}
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const JobRun3 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (JobRun3?.setOrganization)
{
await
JobRun3.
setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const JobRun4 = await JobRuns.findOne({
order: [['id', 'ASC']],
offset: 4
});
if (JobRun4?.setOrganization)
{
await
JobRun4.
setOrganization(relatedOrganization4);
}
}
module.exports = {
up: async (queryInterface, Sequelize) => {
await Organizations.bulkCreate(OrganizationsData);
await UserProfiles.bulkCreate(UserProfilesData);
await UserProfileTypes.bulkCreate(UserProfileTypesData);
await Declarations.bulkCreate(DeclarationsData);
await Dependents.bulkCreate(DependentsData);
await DataSources.bulkCreate(DataSourcesData);
await Transactions.bulkCreate(TransactionsData);
await Documents.bulkCreate(DocumentsData);
await IncomePayersPj.bulkCreate(IncomePayersPjData);
await IncomeCarneLeaoMonthly.bulkCreate(IncomeCarneLeaoMonthlyData);
await ExemptIncomes.bulkCreate(ExemptIncomesData);
await ExclusiveIncomes.bulkCreate(ExclusiveIncomesData);
await Assets.bulkCreate(AssetsData);
await Debts.bulkCreate(DebtsData);
await DeductiblePayments.bulkCreate(DeductiblePaymentsData);
await InvestmentPositions.bulkCreate(InvestmentPositionsData);
await Trades.bulkCreate(TradesData);
await MonthlyCapitalGains.bulkCreate(MonthlyCapitalGainsData);
await RiskAnalyses.bulkCreate(RiskAnalysesData);
await Notifications.bulkCreate(NotificationsData);
await OrganizationMemberships.bulkCreate(OrganizationMembershipsData);
await AccountantClientAccesses.bulkCreate(AccountantClientAccessesData);
await AuditLogs.bulkCreate(AuditLogsData);
await Consents.bulkCreate(ConsentsData);
await JobRuns.bulkCreate(JobRunsData);
await Promise.all([
// Similar logic for "relation_many"
await associateUserWithOrganization(),
await associateUserProfileWithUser(),
await associateUserProfileWithOrganization(),
await associateUserProfileTypeWithUser(),
await associateUserProfileTypeWithOrganization(),
await associateDeclarationWithUser(),
await associateDeclarationWithOrganization(),
await associateDependentWithDeclaration(),
await associateDependentWithOrganization(),
await associateDataSourceWithDeclaration(),
await associateDataSourceWithOrganization(),
await associateTransactionWithDeclaration(),
await associateTransactionWithData_source(),
await associateTransactionWithOrganization(),
await associateDocumentWithDeclaration(),
await associateDocumentWithOrganization(),
await associateIncomePayersPjWithDeclaration(),
await associateIncomePayersPjWithOrganization(),
await associateIncomeCarneLeaoMonthlyWithDeclaration(),
await associateIncomeCarneLeaoMonthlyWithOrganization(),
await associateExemptIncomeWithDeclaration(),
await associateExemptIncomeWithOrganization(),
await associateExclusiveIncomeWithDeclaration(),
await associateExclusiveIncomeWithOrganization(),
await associateAssetWithDeclaration(),
await associateAssetWithOrganization(),
await associateDebtWithDeclaration(),
await associateDebtWithOrganization(),
await associateDeductiblePaymentWithDeclaration(),
await associateDeductiblePaymentWithDependent(),
await associateDeductiblePaymentWithOrganization(),
await associateInvestmentPositionWithDeclaration(),
await associateInvestmentPositionWithOrganization(),
await associateTradeWithDeclaration(),
await associateTradeWithOrganization(),
await associateMonthlyCapitalGainWithDeclaration(),
await associateMonthlyCapitalGainWithOrganization(),
await associateRiskAnalysWithDeclaration(),
await associateRiskAnalysWithOrganization(),
await associateNotificationWithUser(),
await associateNotificationWithOrganization(),
await associateOrganizationMembershipWithOrganization(),
await associateOrganizationMembershipWithUser(),
await associateAccountantClientAccessWithAccountant(),
await associateAccountantClientAccessWithClient(),
await associateAccountantClientAccessWithOrganization(),
await associateAuditLogWithUser(),
await associateAuditLogWithOrganization(),
await associateConsentWithUser(),
await associateConsentWithOrganization(),
await associateJobRunWithDeclaration(),
await associateJobRunWithOrganization(),
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('organizations', null, {});
await queryInterface.bulkDelete('user_profiles', null, {});
await queryInterface.bulkDelete('user_profile_types', null, {});
await queryInterface.bulkDelete('declarations', null, {});
await queryInterface.bulkDelete('dependents', null, {});
await queryInterface.bulkDelete('data_sources', null, {});
await queryInterface.bulkDelete('transactions', null, {});
await queryInterface.bulkDelete('documents', null, {});
await queryInterface.bulkDelete('income_payers_pj', null, {});
await queryInterface.bulkDelete('income_carne_leao_monthly', null, {});
await queryInterface.bulkDelete('exempt_incomes', null, {});
await queryInterface.bulkDelete('exclusive_incomes', null, {});
await queryInterface.bulkDelete('assets', null, {});
await queryInterface.bulkDelete('debts', null, {});
await queryInterface.bulkDelete('deductible_payments', null, {});
await queryInterface.bulkDelete('investment_positions', null, {});
await queryInterface.bulkDelete('trades', null, {});
await queryInterface.bulkDelete('monthly_capital_gains', null, {});
await queryInterface.bulkDelete('risk_analyses', null, {});
await queryInterface.bulkDelete('notifications', null, {});
await queryInterface.bulkDelete('organization_memberships', null, {});
await queryInterface.bulkDelete('accountant_client_accesses', null, {});
await queryInterface.bulkDelete('audit_logs', null, {});
await queryInterface.bulkDelete('consents', null, {});
await queryInterface.bulkDelete('job_runs', null, {});
},
};