Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { createTenantKnex } from '../src/lib/db/index.tsx';
|
|
|
|
async function run() {
|
|
const targetInvoiceId = process.env.INVOICE_ID;
|
|
if (!targetInvoiceId) {
|
|
throw new Error('INVOICE_ID env var required');
|
|
}
|
|
|
|
const { knex, tenant } = await createTenantKnex();
|
|
console.log('Tenant:', tenant);
|
|
|
|
const invoice = await knex('invoices')
|
|
.where({ invoice_id: targetInvoiceId })
|
|
.first();
|
|
console.log('Invoice:', invoice);
|
|
|
|
if (!invoice) {
|
|
return;
|
|
}
|
|
|
|
const items = await knex('invoice_charges')
|
|
.where({ invoice_id: targetInvoiceId })
|
|
.orderBy('created_at', 'asc');
|
|
console.log('Invoice items:', items);
|
|
|
|
const itemDetails = await knex('invoice_charge_details')
|
|
.where({ invoice_id: targetInvoiceId })
|
|
.orderBy('created_at', 'asc');
|
|
console.log('Invoice item details:', itemDetails);
|
|
|
|
const clientLines = await knex('client_contract_lines')
|
|
.where({ client_id: invoice.client_id, tenant })
|
|
.orderBy('created_at', 'asc');
|
|
console.log('Client contract lines:', clientLines);
|
|
|
|
const lineIds = clientLines.map((line) => line.client_contract_line_id);
|
|
if (lineIds.length > 0) {
|
|
const pricing = await knex('client_contract_line_pricing')
|
|
.whereIn('client_contract_line_id', lineIds)
|
|
.andWhere({ tenant });
|
|
console.log('Client line pricing:', pricing);
|
|
}
|
|
}
|
|
|
|
run()
|
|
.catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
})
|
|
.then(() => process.exit(0));
|