PSA/server/seeds/dev/05_contacts.cjs
Hermes 284313f908
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
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

83 lines
2.6 KiB
JavaScript

const { randomUUID } = require('crypto');
exports.seed = async function seed(knex) {
const tenant = await knex('tenants').select('tenant').first();
if (!tenant) return;
const dorothyContactId = randomUUID();
const aliceContactId = randomUUID();
await knex('contacts').insert([
{
tenant: tenant.tenant,
contact_name_id: dorothyContactId,
full_name: 'Dorothy Gale',
client_id: knex('clients')
.where({
tenant: tenant.tenant,
client_name: 'Emerald City'
})
.select('client_id')
.first(),
email: 'dorothy@oz.com',
primary_email_canonical_type: 'work',
created_at: knex.fn.now(),
updated_at: knex.fn.now()
},
{
tenant: tenant.tenant,
contact_name_id: aliceContactId,
full_name: 'Alice in Wonderland',
client_id: knex('clients')
.where({
tenant: tenant.tenant,
client_name: 'Wonderland'
})
.select('client_id')
.first(),
email: 'alice@wonderland.com',
primary_email_canonical_type: 'personal',
created_at: knex.fn.now(),
updated_at: knex.fn.now()
}
]);
await knex('contact_additional_email_addresses').insert([
{
tenant: tenant.tenant,
contact_additional_email_address_id: randomUUID(),
contact_name_id: dorothyContactId,
email_address: 'dorothy.billing@oz.com',
canonical_type: 'billing',
display_order: 0,
created_at: knex.fn.now(),
updated_at: knex.fn.now()
}
]);
await knex('contact_phone_numbers').insert([
{
tenant: tenant.tenant,
contact_name_id: dorothyContactId,
contact_phone_number_id: randomUUID(),
phone_number: '+1-555-987-6543',
canonical_type: 'work',
is_default: true,
display_order: 0,
created_at: knex.fn.now(),
updated_at: knex.fn.now()
},
{
tenant: tenant.tenant,
contact_name_id: aliceContactId,
contact_phone_number_id: randomUUID(),
phone_number: '+1-555-246-8135',
canonical_type: 'work',
is_default: true,
display_order: 0,
created_at: knex.fn.now(),
updated_at: knex.fn.now()
}
]);
};