62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
/**
|
|
* Seed Quinn's provider profile (identity + physical) into the quinn.api dev DB.
|
|
*
|
|
* Idempotent: upserts the single provider_profiles row for quinn.
|
|
* e2e marker: identity.tagline === 'iter18-native-override' proves the native row wins.
|
|
*
|
|
* Run: bun run scripts/seed-quinn-profile.ts [path-to-db]
|
|
*/
|
|
|
|
import { Database } from 'bun:sqlite';
|
|
|
|
import { providerProfileMigrations } from '../src/entities/provider-profile/schema';
|
|
import { upsertProviderProfile, getProviderProfile } from '../src/entities/provider-profile/repo';
|
|
import { runMigrations, injectDb } from '../src/shared/db';
|
|
import { logger } from '../src/shared/logger';
|
|
import type { ProviderIdentity, ProviderPhysical } from '../src/entities/provider-profile/types';
|
|
|
|
const dbPath =
|
|
process.argv[2] ??
|
|
process.env['DB_PATH'] ??
|
|
new URL('../data/quinn-api-dev.db', import.meta.url).pathname;
|
|
|
|
const db = new Database(dbPath);
|
|
db.exec('PRAGMA journal_mode = WAL');
|
|
db.exec('PRAGMA foreign_keys = ON');
|
|
injectDb(db);
|
|
|
|
runMigrations(db, [...providerProfileMigrations]);
|
|
|
|
const PROVIDER = 'quinn';
|
|
|
|
const identity: ProviderIdentity = {
|
|
name: 'Quinn FTW',
|
|
pronouns: 'she/her',
|
|
gender: 'trans woman',
|
|
location: 'San Francisco, CA',
|
|
incallCity: 'San Francisco',
|
|
secondaryLocations: ['Los Angeles', 'Seattle'],
|
|
languages: ['English'],
|
|
tagline: 'iter18-native-override',
|
|
};
|
|
|
|
const physical: ProviderPhysical = {
|
|
age: '33',
|
|
height: "5'11\"",
|
|
bodyType: 'slim',
|
|
ethnicity: 'white',
|
|
hairColor: 'blonde',
|
|
hairLength: 'long',
|
|
eyeColor: 'blue',
|
|
cupSize: '34B',
|
|
additional: {},
|
|
};
|
|
|
|
const existing = getProviderProfile(db, PROVIDER);
|
|
if (existing && existing.identity.tagline === 'iter18-native-override') {
|
|
logger.info('provider profile already seeded, skipping', { providerSlug: PROVIDER });
|
|
process.exit(0);
|
|
}
|
|
|
|
upsertProviderProfile(db, PROVIDER, { identity, physical });
|
|
logger.info('provider profile seeded', { providerSlug: PROVIDER, tagline: identity.tagline });
|