Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ export default defineNuxtConfig({
/** When set, the dashboard shows a read-only demo banner for this org slug */
demoOrgSlug: process.env.DEMO_ORG_SLUG || (isRailwayPreview ? 'reqcore-demo' : ''),
/** Public live-demo account email used to prefill sign-in */
liveDemoEmail:
process.env.LIVE_DEMO_EMAIL
|| process.env.DEMO_EMAIL
|| 'demo@reqcore.com',
liveDemoEmail: (() => {
const email =
process.env.LIVE_DEMO_EMAIL
|| process.env.DEMO_EMAIL
|| 'demo@reqcore.com'
// Guard against stale applirank.com domain from old env vars
if (email.endsWith('@applirank.com')) {
console.warn('[config] Stale demo email detected (applirank.com domain) — falling back to demo@reqcore.com')
return 'demo@reqcore.com'
}
return email
})(),
/** Public URL for hosted plan upsell CTA shown in preview mode modals */
hostedPlanUrl: process.env.NUXT_PUBLIC_HOSTED_PLAN_URL || 'https://reqcore.com',
/** Public live-demo secret used to prefill sign-in */
Expand Down
36 changes: 36 additions & 0 deletions server/scripts/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const DEMO_PASSWORD = process.env.DEMO_PASSWORD ?? 'demo1234'
const DEMO_ORG_NAME = 'Reqcore Demo'
const DEMO_ORG_SLUG = 'reqcore-demo'

// Legacy values from the old applirank.com domain — cleaned up on seed
const LEGACY_DEMO_EMAIL = 'demo@applirank.com'
const LEGACY_ORG_SLUG = 'applirank-demo'

// ─────────────────────────────────────────────
// Database connection
// ─────────────────────────────────────────────
Expand Down Expand Up @@ -358,6 +362,38 @@ function generateResponses(jobIndex: number, candidateIndex: number): Record<str
async function seed() {
console.log('🌱 Seeding Reqcore demo data...\n')

// ─────────────────────────────────────────────
// Clean up legacy applirank.com seed data
// ─────────────────────────────────────────────
const [legacyOrg] = await db
.select({ id: schema.organization.id })
.from(schema.organization)
.where(eq(schema.organization.slug, LEGACY_ORG_SLUG))
.limit(1)

const [legacyUser] = await db
.select({ id: schema.user.id })
.from(schema.user)
.where(eq(schema.user.email, LEGACY_DEMO_EMAIL))
.limit(1)

if (legacyOrg || legacyUser) {
console.log('🧹 Removing legacy applirank.com demo data...')

if (legacyOrg) {
// All child tables (jobs, candidates, applications, members, etc.) have
// onDelete: 'cascade' so deleting the org removes everything beneath it.
await db.delete(schema.organization).where(eq(schema.organization.id, legacyOrg.id))
console.log(` ✅ Deleted legacy org: ${LEGACY_ORG_SLUG}`)
}

if (legacyUser) {
// sessions and accounts also cascade from the user row
await db.delete(schema.user).where(eq(schema.user.id, legacyUser.id))
console.log(` ✅ Deleted legacy user: ${LEGACY_DEMO_EMAIL}`)
}
}

// Check if demo org already exists
const existingOrg = await db
.select()
Expand Down